aboutsummaryrefslogtreecommitdiff
path: root/src/netbeansAgent/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-12-04 23:52:24 +0100
committerReinier Zwitserloot <reinier@tipit.to>2009-12-04 23:52:24 +0100
commit9cb622b83da5637324debdf41430d62fed8da51f (patch)
treef257ffab472c1d56f282d027321d6cccb14bfe54 /src/netbeansAgent/lombok
parent3fc9fdb4855d666224322732ff7011d2eb1626d4 (diff)
downloadlombok-9cb622b83da5637324debdf41430d62fed8da51f.tar.gz
lombok-9cb622b83da5637324debdf41430d62fed8da51f.tar.bz2
lombok-9cb622b83da5637324debdf41430d62fed8da51f.zip
One of the netbeans patches would cause a VerifyError on test builds of netbeans (class verification is off for netbeans distro versions).
fixed.
Diffstat (limited to 'src/netbeansAgent/lombok')
-rw-r--r--src/netbeansAgent/lombok/netbeans/agent/NetbeansPatcher.java2
-rw-r--r--src/netbeansAgent/lombok/netbeans/agent/PatchFixes.java12
2 files changed, 9 insertions, 5 deletions
diff --git a/src/netbeansAgent/lombok/netbeans/agent/NetbeansPatcher.java b/src/netbeansAgent/lombok/netbeans/agent/NetbeansPatcher.java
index 39df269b..e6ae5c03 100644
--- a/src/netbeansAgent/lombok/netbeans/agent/NetbeansPatcher.java
+++ b/src/netbeansAgent/lombok/netbeans/agent/NetbeansPatcher.java
@@ -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()
diff --git a/src/netbeansAgent/lombok/netbeans/agent/PatchFixes.java b/src/netbeansAgent/lombok/netbeans/agent/PatchFixes.java
index d9b858cd..7b85be29 100644
--- a/src/netbeansAgent/lombok/netbeans/agent/PatchFixes.java
+++ b/src/netbeansAgent/lombok/netbeans/agent/PatchFixes.java
@@ -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) {