aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-13 21:47:19 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-13 21:47:19 +0200
commit60b7a300df7068430ec193d2a52c6876e1891afa (patch)
tree60fde7264b05eba616e18f47c2f3cc5643b78268 /ajdoc/src
parent31d2091f89ac5bfd3be705b7912ad6ea8b402f88 (diff)
downloadaspectj-60b7a300df7068430ec193d2a52c6876e1891afa.tar.gz
aspectj-60b7a300df7068430ec193d2a52c6876e1891afa.zip
Fix compilation of JavadocRunner for Java 13+
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'ajdoc/src')
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
index 64e53eead..20ec37f2f 100644
--- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
+++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
@@ -32,10 +32,10 @@ class JavadocRunner {
static boolean has14ToolsAvailable() {
try {
- Class jdMainClass = com.sun.tools.javadoc.Main.class;
- Class[] paramTypes = new Class[] { String[].class };
+ Class<?> jdMainClass = Class.forName("com.sun.tools.javadoc.Main");
+ Class<?>[] paramTypes = new Class[] { String[].class };
jdMainClass.getMethod("execute", paramTypes);
- } catch (NoClassDefFoundError e) {
+ } catch (NoClassDefFoundError | ClassNotFoundException e) {
return false;
} catch (UnsupportedClassVersionError e) {
return false;
@@ -73,13 +73,13 @@ class JavadocRunner {
try {
// for JDK 1.4 and above call the execute method...
- Class jdMainClass = com.sun.tools.javadoc.Main.class;
+ Class<?> jdMainClass = Class.forName("com.sun.tools.javadoc.Main");
Method executeMethod = null;
try {
Class[] paramTypes = new Class[] { String[].class };
executeMethod = jdMainClass.getMethod("execute", paramTypes);
} catch (NoSuchMethodException e) {
- com.sun.tools.javadoc.Main.main(javadocargs);
+ executeMethod = jdMainClass.getMethod("main", String[].class);
// throw new UnsupportedOperationException("ajdoc requires a tools library from JDK 1.4 or later.");
}
try {
@@ -96,6 +96,8 @@ class JavadocRunner {
} catch (SecurityException se) {
// Do nothing since we expect it to be thrown
// System.out.println( ">> se: " + se.getMessage() );
+ } catch (ClassNotFoundException | NoSuchMethodException e) {
+ throw new RuntimeException("Failed to invoke javadoc");
}
// Set the security manager back
// System.setSecurityManager(defaultSecurityManager);