use of com.sun.tools.javac.comp.Resolve.RecoveryLoadClass in project checker-framework by typetools.
the class DefaultReflectionResolver method getSymbol.
private Symbol getSymbol(String className, Env<AttrContext> env, Names names, Resolve resolve) {
Method loadClass;
try {
loadClass = Resolve.class.getDeclaredMethod("loadClass", Env.class, Name.class, RecoveryLoadClass.class);
loadClass.setAccessible(true);
} catch (SecurityException | NoSuchMethodException | IllegalArgumentException e) {
// A problem with javac is serious and must be reported.
throw new BugInCF("Error in obtaining reflective method.", e);
}
try {
RecoveryLoadClass noRecovery = (e, n) -> null;
return (Symbol) loadClass.invoke(resolve, env, names.fromString(className), noRecovery);
} catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
// A problem with javac is serious and must be reported.
throw new BugInCF("Error in invoking reflective method.", e);
}
}
Aggregations