aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-06-13 22:07:30 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-06-13 22:07:30 +0200
commitcea08d77998acce659c6ffc712045b9772ad9c65 (patch)
tree80cad21e63d376509c16566745b498fcb093e887 /src
parent274d5de571f76b04aa140ea9c04dfc23353dd9f6 (diff)
downloadlombok-cea08d77998acce659c6ffc712045b9772ad9c65.tar.gz
lombok-cea08d77998acce659c6ffc712045b9772ad9c65.tar.bz2
lombok-cea08d77998acce659c6ffc712045b9772ad9c65.zip
Fixed PrintAST, and separately SneakyThrows/Synchronized which failed because the 'isFullParse' boolean was erronously set on a full rebuild, forced by HandleDelegate.
HandleDelegate has also been updated to not do so much work if there's no @Delegate in a source file.
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/EclipseAST.java8
-rw-r--r--src/core/lombok/eclipse/TransformEclipseAST.java2
-rw-r--r--src/core/lombok/eclipse/handlers/HandlePrintAST.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java16
4 files changed, 22 insertions, 8 deletions
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java
index 7c816c50..91db0baa 100644
--- a/src/core/lombok/eclipse/EclipseAST.java
+++ b/src/core/lombok/eclipse/EclipseAST.java
@@ -197,16 +197,16 @@ 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(boolean forceRebuild) {
+ public void rebuild(boolean force) {
propagateProblems();
- if (completeParse && !forceRebuild) return;
+ if (completeParse && !force) return;
boolean changed = isChanged();
boolean newCompleteParse = isComplete(compilationUnitDeclaration);
- if (!newCompleteParse && !forceRebuild) return;
+ if (!newCompleteParse && !force) return;
top().rebuild();
- this.completeParse = true;
+ this.completeParse = newCompleteParse;
if (!changed) clearChanged();
}
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java
index e260604b..7ef06fca 100644
--- a/src/core/lombok/eclipse/TransformEclipseAST.java
+++ b/src/core/lombok/eclipse/TransformEclipseAST.java
@@ -101,7 +101,7 @@ public class TransformEclipseAST {
} catch (Exception ignore) {
}
} else {
- existing.reparse(forceRebuild);
+ existing.rebuild(forceRebuild);
}
return existing;
diff --git a/src/core/lombok/eclipse/handlers/HandlePrintAST.java b/src/core/lombok/eclipse/handlers/HandlePrintAST.java
index 24a3f687..6fa7b938 100644
--- a/src/core/lombok/eclipse/handlers/HandlePrintAST.java
+++ b/src/core/lombok/eclipse/handlers/HandlePrintAST.java
@@ -41,12 +41,10 @@ import lombok.eclipse.EclipseNode;
@ProviderFor(EclipseAnnotationHandler.class)
public class HandlePrintAST implements EclipseAnnotationHandler<PrintAST> {
@Override public boolean deferUntilPostDiet() {
- return false;
+ return true;
}
public void handle(AnnotationValues<PrintAST> annotation, Annotation ast, EclipseNode annotationNode) {
- if (!annotationNode.isCompleteParse()) return;
-
PrintStream stream = System.out;
String fileName = annotation.getInstance().outfile();
if (fileName.length() > 0) try {
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
index 71fa1dc5..9929de2a 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
@@ -103,8 +103,24 @@ public class PatchDelegate {
return new String(decl.name);
}
+ private static boolean hasDelegateMarkedFields(TypeDeclaration decl) {
+ if (decl.fields != null) for (FieldDeclaration field : decl.fields) {
+ if (field.annotations == null) continue;
+ for (Annotation ann : field.annotations) {
+ if (ann.type == null) continue;
+ TypeBinding tb = ann.type.resolveType(decl.initializerScope);
+ if (!charArrayEquals("lombok", tb.qualifiedPackageName())) continue;
+ if (!charArrayEquals("Delegate", tb.qualifiedSourceName())) continue;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public static boolean handleDelegateForType(ClassScope scope) {
if (TransformEclipseAST.disableLombok) return false;
+ if (!hasDelegateMarkedFields(scope.referenceContext)) return false;
List<ClassScopeEntry> stack = visited.get();
StringBuilder corrupted = null;