diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-06-13 22:07:30 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-06-13 22:07:30 +0200 |
commit | cea08d77998acce659c6ffc712045b9772ad9c65 (patch) | |
tree | 80cad21e63d376509c16566745b498fcb093e887 /src/eclipseAgent/lombok/eclipse | |
parent | 274d5de571f76b04aa140ea9c04dfc23353dd9f6 (diff) | |
download | lombok-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/eclipseAgent/lombok/eclipse')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java | 16 |
1 files changed, 16 insertions, 0 deletions
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; |