diff options
Diffstat (limited to 'src/eclipseAgent')
-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; |