Skip to content

Commit

Permalink
Fix SourcepathIgnoringInvocationHandler on Java 9
Browse files Browse the repository at this point in the history
Use the method provided by the proxy API instead of
trying to look up the same method on the delegate's
class. It is unclear why this was done in the first place.
Trying to access the method from the delegate lead to
illegal access exceptions on certain JDKs.
  • Loading branch information
oehme committed Apr 5, 2018
1 parent 07784de commit f6fd43e
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public SourcepathIgnoringInvocationHandler(Object proxied) {
@Override
@SuppressWarnings("unchecked")
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Method m = proxied.getClass().getMethod(method.getName(), method.getParameterTypes());
if (method.getName().equals(HAS_LOCATION_METHOD)) {
// There is currently a requirement in the JDK9 javac implementation
// that when javac is invoked with an explicitly empty sourcepath
Expand All @@ -62,6 +61,6 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
((Set<JavaFileObject.Kind>) args[2]).remove(JavaFileObject.Kind.SOURCE);
}
}
return m.invoke(proxied, args);
return method.invoke(proxied, args);
}
}

0 comments on commit f6fd43e

Please sign in to comment.