mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
One of the netbeans patches would cause a VerifyError on test builds of netbeans (class verification is off for netbeans distro versions).
fixed.
This commit is contained in:
1 parent
3fc9fdb485
commit
9cb622b83d
2 files changed
+9
-5
No files matched your search
@@ -58,7 +58,7 @@ public class NetbeansPatcher extends Agent {
|
||||
sm.addScript(ScriptBuilder.exitEarly()
|
||||
.transplant().request(StackRequest.PARAM1, StackRequest.PARAM2)
|
||||
.target(new MethodTarget("org.netbeans.StandardModule$OneModuleClassLoader", "<init>"))
|
||||
.decisionMethod(new Hook("lombok/netbeans/agent/PatchFixes", "addSelfToClassLoader", "(Lorg/netbeans/Module;Ljava/util/List;)Z"))
|
||||
.decisionMethod(new Hook("lombok/netbeans/agent/PatchFixes", "addSelfToClassLoader", "(Lorg/netbeans/Module;Ljava/util/List;)V"))
|
||||
.build());
|
||||
sm.addScript(ScriptBuilder.exitEarly()
|
||||
.transplant()
|
||||
|
||||
@@ -84,13 +84,11 @@ public class PatchFixes {
|
||||
return (Enumeration<?>) m.invoke(loader, name);
|
||||
}
|
||||
|
||||
public static boolean addSelfToClassLoader(Module module, List<File> classPath) {
|
||||
public static void addSelfToClassLoader(Module module, List<File> classPath) {
|
||||
if (module.getJarFile().getName().equals("org-netbeans-libs-javacimpl.jar")) {
|
||||
String lombokJarLoc = LiveInjector.findPathJar(Lombok.class);
|
||||
classPath.add(new File(lombokJarLoc));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void fixContentOnSetTaskListener(JavacTaskImpl that, TaskListener taskListener) throws Throwable {
|
||||
@@ -133,8 +131,14 @@ public class PatchFixes {
|
||||
|
||||
public static void addTaskListenerWhenCallingJavac(JavacTaskImpl task,
|
||||
@SuppressWarnings("unused") /* Will come in handy later */ ClasspathInfo cpInfo) throws Exception {
|
||||
if (task == null) return;
|
||||
Class<?> entryPoint = JavacTaskImpl.class.getClassLoader().loadClass("lombok.netbeans.agent.NetbeansEntryPoint");
|
||||
task.setTaskListener((TaskListener) entryPoint.getConstructor(Context.class).newInstance(task.getContext()));
|
||||
if (entryPoint == null) {
|
||||
/* TODO tell the user that lombok is not working. loadClass is not supposed to return null, but netbeans' loader does anyway. */
|
||||
System.err.println("[LOMBOK] ClassLoader not patched correctly.");
|
||||
} else {
|
||||
task.setTaskListener((TaskListener) entryPoint.getConstructor(Context.class).newInstance(task.getContext()));
|
||||
}
|
||||
}
|
||||
|
||||
public static Iterator<JCTree> filterGenerated(final Iterator<JCTree> it) {
|
||||
|
||||
Reference in new issue
Block a user