diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-08 06:25:38 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2014-05-20 23:43:08 +0200 |
commit | 4996428ea12be7e381d76614e34a15ad1cc6d275 (patch) | |
tree | ca5067b7b8f63eff6adeed83f8ff9339128d8ca7 /src/core/lombok/javac | |
parent | 05ca21b75e5c20e1e731d9141857f346bb3eca9f (diff) | |
download | lombok-4996428ea12be7e381d76614e34a15ad1cc6d275.tar.gz lombok-4996428ea12be7e381d76614e34a15ad1cc6d275.tar.bz2 lombok-4996428ea12be7e381d76614e34a15ad1cc6d275.zip |
@Delegate has moved to lombok.experimental.
Some work on the aliasing system to make that go smoothly.
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/JavacImportList.java | 19 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleDelegate.java | 6 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleGetter.java | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/core/lombok/javac/JavacImportList.java b/src/core/lombok/javac/JavacImportList.java index d5d7460a..2665ca7c 100644 --- a/src/core/lombok/javac/JavacImportList.java +++ b/src/core/lombok/javac/JavacImportList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Project Lombok Authors. + * Copyright (C) 2013-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -23,7 +23,6 @@ package lombok.javac; import java.util.ArrayList; import java.util.Collection; -import java.util.Map; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; @@ -59,12 +58,15 @@ public class JavacImportList implements ImportList { } @Override public boolean hasStarImport(String packageName) { - for (Map.Entry<String, String> e : LombokInternalAliasing.IMPLIED_EXTRA_STAR_IMPORTS.entrySet()) { - if (e.getValue().equals(packageName) && hasStarImport(e.getKey())) return true; - } - if (pkg != null && pkg.toString().equals(packageName)) return true; + String pkgStr = pkg == null ? null : pkg.toString(); + if (pkgStr != null && pkgStr.equals(packageName)) return true; if ("java.lang".equals(packageName)) return true; + if (pkgStr != null) { + Collection<String> extra = LombokInternalAliasing.IMPLIED_EXTRA_STAR_IMPORTS.get(pkgStr); + if (extra != null && extra.contains(packageName)) return true; + } + for (JCTree def : defs) { if (!(def instanceof JCImport)) continue; if (((JCImport) def).staticImport) continue; @@ -72,7 +74,10 @@ public class JavacImportList implements ImportList { if (!(qual instanceof JCFieldAccess)) continue; String simpleName = ((JCFieldAccess) qual).name.toString(); if (!"*".equals(simpleName)) continue; - if (packageName.equals(((JCFieldAccess) qual).selected.toString())) return true; + String starImport = ((JCFieldAccess) qual).selected.toString(); + if (packageName.equals(starImport)) return true; + Collection<String> extra = LombokInternalAliasing.IMPLIED_EXTRA_STAR_IMPORTS.get(starImport); + if (extra != null && extra.contains(packageName)) return true; } return false; diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index ec6ea20c..9cd8844e 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -25,6 +25,7 @@ import static lombok.core.handlers.HandlerUtil.*; import static lombok.javac.handlers.JavacHandlerUtil.*; import static com.sun.tools.javac.code.Flags.*; +import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -42,7 +43,7 @@ import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import lombok.ConfigurationKeys; -import lombok.Delegate; +import lombok.experimental.Delegate; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -101,7 +102,8 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> { @Override public void handle(AnnotationValues<Delegate> annotation, JCAnnotation ast, JavacNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.DELEGATE_FLAG_USAGE, "@Delegate"); - deleteAnnotationIfNeccessary(annotationNode, Delegate.class); + @SuppressWarnings("deprecation") Class<? extends Annotation> oldDelegate = lombok.Delegate.class; + deleteAnnotationIfNeccessary(annotationNode, Delegate.class, oldDelegate); Type delegateType; Name delegateName = annotationNode.toName(annotationNode.up().getName()); diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index 48a13bde..063741e2 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -33,7 +33,7 @@ import java.util.Map; import lombok.AccessLevel; import lombok.ConfigurationKeys; -import lombok.Delegate; +import lombok.experimental.Delegate; import lombok.Getter; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; |