mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use bootstrap classloader to only provide access to JRE classes
This commit is contained in:
committed by
Egor.Ushakov
parent
ed0554096f
commit
8f5910802b
+2
-1
@@ -30,7 +30,8 @@ public class ClasspathHelper {
|
||||
|
||||
private static Method findMethodOnClasspath(String targetClass, String methodSignature) {
|
||||
try {
|
||||
Class cls = Class.forName(targetClass);
|
||||
// use bootstrap classloader to only provide access to JRE classes
|
||||
Class cls = new ClassLoader(null) {}.loadClass(targetClass);
|
||||
for (Method mtd : cls.getMethods()) {
|
||||
// use contains() to ignore access modifiers and thrown exceptions
|
||||
if (mtd.toString().contains(methodSignature)) {
|
||||
|
||||
+2
@@ -394,6 +394,8 @@ public class InvocationExprent extends Exprent {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TODO: tap into IDEA indices to access libraries methods details
|
||||
|
||||
// try to check the class on the classpath
|
||||
Method mtd = ClasspathHelper.findMethod(classname, name, descriptor);
|
||||
return mtd != null && mtd.isVarArgs();
|
||||
|
||||
Reference in New Issue
Block a user