mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 22:16:11 +00:00
Resolve-phase transformers in eclipse need to force a rebuild of the EclipseAST object.
Fixes issue #171
This commit is contained in:
1 parent
59e2a0ff1d
commit
fb1d6c0f0d
3 files changed
+7
-7
No files matched your search
@@ -196,12 +196,12 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> {
|
||||
* with filled in method bodies and such. Also propagates problems and errors, which in diet parse
|
||||
* mode can't be reliably added to the problems/warnings view.
|
||||
*/
|
||||
public void reparse() {
|
||||
public void reparse(boolean forceRebuild) {
|
||||
propagateProblems();
|
||||
if (completeParse) return;
|
||||
if (completeParse && !forceRebuild) return;
|
||||
boolean changed = isChanged();
|
||||
boolean newCompleteParse = isComplete(compilationUnitDeclaration);
|
||||
if (!newCompleteParse) return;
|
||||
if (!newCompleteParse && !forceRebuild) return;
|
||||
|
||||
top().rebuild();
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TransformEclipseAST {
|
||||
transform(parser, ast);
|
||||
}
|
||||
|
||||
public static EclipseAST getAST(CompilationUnitDeclaration ast) {
|
||||
public static EclipseAST getAST(CompilationUnitDeclaration ast, boolean forceRebuild) {
|
||||
EclipseAST existing = null;
|
||||
if (astCacheField != null) {
|
||||
try {
|
||||
@@ -101,7 +101,7 @@ public class TransformEclipseAST {
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
} else {
|
||||
existing.reparse();
|
||||
existing.reparse(forceRebuild);
|
||||
}
|
||||
|
||||
return existing;
|
||||
@@ -126,7 +126,7 @@ public class TransformEclipseAST {
|
||||
// Do NOT abort if (ast.bits & ASTNode.HasAllMethodBodies) != 0 - that doesn't work.
|
||||
|
||||
try {
|
||||
EclipseAST existing = getAST(ast);
|
||||
EclipseAST existing = getAST(ast, false);
|
||||
new TransformEclipseAST(existing).go();
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
|
||||
@@ -113,7 +113,7 @@ public class PatchDelegate {
|
||||
|
||||
if (cud == null) {
|
||||
cud = scope.compilationUnitScope().referenceContext;
|
||||
eclipseAst = TransformEclipseAST.getAST(cud);
|
||||
eclipseAst = TransformEclipseAST.getAST(cud, true);
|
||||
}
|
||||
|
||||
List<ClassLiteralAccess> rawTypes = new ArrayList<ClassLiteralAccess>();
|
||||
|
||||
Reference in new issue
Block a user