mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 10:18:46 +00:00
Lombok disabled during ast creation in DefaultCodeFormatter & CleanUpPostSaveListener
This commit is contained in:
1 parent
9433db4ecd
commit
1950820d35
1 file changed
+16
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user