Skip to content

Commit e314da0

Browse files
committed
[MJAVADOC-821] Align toolchain discovery code with Maven Compiler Plugin
This closes #334
1 parent 62a6861 commit e314da0

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.io.IOException;
2424
import java.io.InputStream;
2525
import java.io.Writer;
26-
import java.lang.reflect.Method;
2726
import java.net.MalformedURLException;
2827
import java.net.URI;
2928
import java.net.URISyntaxException;
@@ -2615,27 +2614,13 @@ public Artifact resolveDependency(Dependency dependency) throws MavenReportExcep
26152614
}
26162615
}
26172616

2618-
// TODO remove the part with ToolchainManager lookup once we depend on
2619-
// 3.0.9 (have it as prerequisite). Define as regular component field then.
26202617
protected final Toolchain getToolchain() {
26212618
Toolchain tc = null;
26222619

26232620
if (jdkToolchain != null) {
2624-
// Maven 3.3.1 has plugin execution scoped Toolchain Support
2625-
try {
2626-
Method getToolchainsMethod = toolchainManager
2627-
.getClass()
2628-
.getMethod("getToolchains", MavenSession.class, String.class, Map.class);
2629-
2630-
@SuppressWarnings("unchecked")
2631-
List<Toolchain> tcs =
2632-
(List<Toolchain>) getToolchainsMethod.invoke(toolchainManager, session, "jdk", jdkToolchain);
2633-
2634-
if (tcs != null && tcs.size() > 0) {
2635-
tc = tcs.get(0);
2636-
}
2637-
} catch (SecurityException | ReflectiveOperationException e) {
2638-
// ignore
2621+
List<Toolchain> tcs = toolchainManager.getToolchains(session, "jdk", jdkToolchain);
2622+
if (tcs != null && !tcs.isEmpty()) {
2623+
tc = tcs.get(0);
26392624
}
26402625
}
26412626

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy