This commit is contained in:
Reinier Zwitserloot committed 2009-12-01 00:24:42 +01:00
1 parent 9fb4c3a424
commit 92e2afe9b0
2 files changed
+14 -17

No files matched your search

@@ -67,8 +67,8 @@ public class NetbeansPatcher {
.transplant()
.target(new MethodTarget("org.netbeans.modules.java.source.parsing.JavacParser", "createJavacTask",
"com.sun.tools.javac.api.JavacTaskImpl",
"ClasspathInfo", "DiagnosticListener", "java.lang.String", "boolean",
"ClassNamesForFileOraculum", "CancelService"))
"org.netbeans.api.java.source.ClasspathInfo", "javax.tools.DiagnosticListener", "java.lang.String", "boolean",
"com.sun.tools.javac.api.ClassNamesForFileOraculum", "com.sun.tools.javac.util.CancelService"))
.wrapMethod(new Hook("lombok/netbeans/agent/PatchFixes", "addTaskListenerWhenCallingJavac",
"(Lcom/sun/tools/javac/api/JavacTaskImpl;Lorg/netbeans/api/java/source/ClasspathInfo;)V"))
.build());
@@ -83,7 +83,7 @@ public class NetbeansPatcher {
.replacementMethod(new Hook("lombok/netbeans/agent/PatchFixes", "returnNullForGeneratedNode",
"(Lcom/sun/source/util/Trees;Ljavax/lang/model/element/Element;Ljava/lang/Object;)" +
"Lcom/sun/source/tree/Tree;"))
.requestExtra(StackRequest.PARAM1)
.requestExtra(StackRequest.PARAM1).transplant()
.build());
sm.addScript(ScriptBuilder.replaceMethodCall()
@@ -93,7 +93,7 @@ public class NetbeansPatcher {
"(Lcom/sun/source/tree/CompilationUnitTree;Lcom/sun/source/tree/Tree;)J"))
.replacementMethod(new Hook("lombok/netbeans/agent/PatchFixes", "returnMinus1ForGeneratedNode",
"(Lcom/sun/source/util/SourcePositions;Lcom/sun/source/tree/CompilationUnitTree;Lcom/sun/source/tree/Tree;)J"))
.build());
.transplant().build());
sm.addScript(ScriptBuilder.wrapMethodCall()
.target(new MethodTarget("org.netbeans.modules.java.source.save.CasualDiff", "filterHidden"))
@@ -48,22 +48,19 @@ public class PatchFixes {
if (context.get(TaskListener.class) != null)
context.put(TaskListener.class, (TaskListener)null);
if (taskListener != null) {
try {
Method m = JavacTaskImpl.class.getDeclaredMethod("wrap", TaskListener.class);
try {
m.setAccessible(true);
} catch (SecurityException ignore) {}
TaskListener w = (TaskListener)m.invoke(that, taskListener);
context.put(TaskListener.class, w);
} catch (InvocationTargetException e) {
throw e.getCause();
}
// try {
// Method m = JavacTaskImpl.class.getDeclaredMethod("wrap", TaskListener.class);
// try {
// m.setAccessible(true);
// } catch (SecurityException ignore) {}
// TaskListener w = (TaskListener)m.invoke(that, taskListener);
context.put(TaskListener.class, taskListener);
// } catch (InvocationTargetException e) {
// throw e.getCause();
// }
}
}
//Contributed by Jan Lahoda (jlahoda@netbeans.org)
//Turned into a patch script by rzwitserloot.
//see http://code.google.com/p/projectlombok/issues/detail?id=20#c3
public static Tree returnNullForGeneratedNode(Trees trees, Element element, Object o) throws Throwable {
try {
Tree tree = trees.getTree(element);