aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
diff options
context:
space:
mode:
authorjvanderhel <Jappe.vanderhel@gmail.com>2011-11-10 23:52:38 +0100
committerjvanderhel <Jappe.vanderhel@gmail.com>2011-11-10 23:52:38 +0100
commit1950820d35c1653389a22bddfa3916e125d4bc24 (patch)
tree1a0a838c659a5620aa3ca97c067e7176876b1fc4 /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
parent9433db4ecdf1a525541581a73161ababee0c352c (diff)
downloadlombok-1950820d35c1653389a22bddfa3916e125d4bc24.tar.gz
lombok-1950820d35c1653389a22bddfa3916e125d4bc24.tar.bz2
lombok-1950820d35c1653389a22bddfa3916e125d4bc24.zip
Lombok disabled during ast creation in DefaultCodeFormatter & CleanUpPostSaveListener
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index b52a3b23..efeca326 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -89,6 +89,7 @@ public class EclipsePatcher extends Agent {
patchHideGeneratedNodes(sm);
patchPostCompileHookEclipse(sm);
patchFixSourceTypeConverter(sm);
+ patchDisableLombokForCodeFormatterAndCleanup(sm);
} else {
patchPostCompileHookEcj(sm);
}
@@ -99,6 +100,21 @@ public class EclipsePatcher extends Agent {
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
+ private static void patchDisableLombokForCodeFormatterAndCleanup(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.formatter.DefaultCodeFormatter", "formatCompilationUnit"))
+ .callToWrap(new Hook("org.eclipse.jdt.internal.core.util.CodeSnippetParsingUtil", "parseCompilationUnit", "org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration", "char[]", "java.util.Map", "boolean"))
+ .symbol("lombok.disable")
+ .build());
+
+ sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener", "createAst"))
+ .callToWrap(new Hook("org.eclipse.jdt.core.dom.ASTParser", "createAST", "org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.core.runtime.IProgressMonitor"))
+ .symbol("lombok.disable")
+ .build());
+ }
+
+
private static void patchDomAstReparseIssues(ScriptManager sm) {
sm.addScript(ScriptBuilder.replaceMethodCall()
.target(new MethodTarget("org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer", "visit"))