Try fix "A save participant caused problems."

The bugfix was originally created by mateusz-matela
This commit is contained in:
cnuessgens committed 2018-01-07 19:34:03 +01:00
1 parent 98f08c2455
commit c025ef0695
1 file changed
+12 -18
@@ -105,7 +105,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
patchHideGeneratedNodes(sm);
patchPostCompileHookEclipse(sm);
patchFixSourceTypeConverter(sm);
patchDisableLombokForCodeFormatterAndCleanup(sm);
patchDisableLombokForCodeCleanup(sm);
patchListRewriteHandleGeneratedMethods(sm);
patchSyntaxAndOccurrencesHighlighting(sm);
patchSortMembersOperation(sm);
@@ -214,14 +214,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
.build());
}
private static void patchDisableLombokForCodeFormatterAndCleanup(ScriptManager sm) {
sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
//.target(new MethodTarget("org.eclipse.jdt.internal.formatter.DefaultCodeFormatter", "formatCompilationUnit"))
.target(new MethodTarget("org.eclipse.jdt.internal.formatter.DefaultCodeFormatter", "parseSourceCode"))
.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());
private static void patchDisableLombokForCodeCleanup(ScriptManager sm) {
sm.addScript(ScriptBuilder.exitEarly()
.target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.DoStatement"))
.target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.EnhancedForStatement"))
@@ -340,18 +333,19 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
}
private static void patchFormatters(ScriptManager sm) {
// before Eclipse Mars
sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
.target(new MethodTarget("org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy", "format", "void"))
.callToWrap(new Hook("org.eclipse.jdt.internal.corext.util.CodeFormatterUtil", "reformat", "org.eclipse.text.edits.TextEdit",
"int", "java.lang.String", "int", "int", "int", "java.lang.String", "java.util.Map"))
.symbol("lombok.disable").build());
.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());
// Eclipse Mars and beyond
sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
.target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeFormatFix", "createCleanUp", "org.eclipse.jdt.ui.cleanup.ICleanUpFix",
"org.eclipse.jdt.core.ICompilationUnit", "org.eclipse.jface.text.IRegion[]", "boolean", "boolean", "boolean", "boolean"))
.callToWrap(new Hook("org.eclipse.jdt.internal.corext.util.CodeFormatterUtil", "reformat", "org.eclipse.text.edits.TextEdit",
"int", "java.lang.String", "int", "java.lang.String", "java.util.Map"))
.symbol("lombok.disable").build());
.target(new MethodTarget("org.eclipse.jdt.internal.formatter.DefaultCodeFormatter", "parseSourceCode"))
.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 patchRefactorScripts(ScriptManager sm) {