diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-12-21 21:56:08 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-12-22 09:28:28 +0100 |
commit | 161bcbaf8876e41e9ec6a6478d4444e144df5a92 (patch) | |
tree | 9d84171db7ac13fe1c08ecd08999cbeea3aa2725 /src/core/lombok/eclipse/Eclipse.java | |
parent | e15de71fd410351cd6323a469b30300ccf4bba55 (diff) | |
download | lombok-161bcbaf8876e41e9ec6a6478d4444e144df5a92.tar.gz lombok-161bcbaf8876e41e9ec6a6478d4444e144df5a92.tar.bz2 lombok-161bcbaf8876e41e9ec6a6478d4444e144df5a92.zip |
After 2 weeks of debugging, finally figured out val in eclipse using lombok.val without breaking 'fix imports'. Eesh. Using "lombok.val" only half-works; auto-complete on the variable doesn't work, but it compiles fine and no errors are reported.
Diffstat (limited to 'src/core/lombok/eclipse/Eclipse.java')
-rw-r--r-- | src/core/lombok/eclipse/Eclipse.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/Eclipse.java b/src/core/lombok/eclipse/Eclipse.java index 5dcd9de8..ddba726a 100644 --- a/src/core/lombok/eclipse/Eclipse.java +++ b/src/core/lombok/eclipse/Eclipse.java @@ -533,7 +533,17 @@ public class Eclipse { */ public static boolean annotationTypeMatches(Class<? extends java.lang.annotation.Annotation> type, EclipseNode node) { if (node.getKind() != Kind.ANNOTATION) return false; - TypeReference typeRef = ((Annotation)node.get()).type; + return typeMatches(type, node, ((Annotation)node.get()).type); + } + + /** + * Checks if the given TypeReference node is likely to be a reference to the provided class. + * + * @param type An actual type. This method checks if {@code typeNode} is likely to be a reference to this type. + * @param node A Lombok AST node. Any node in the appropriate compilation unit will do (used to get access to import statements). + * @param typeNode A type reference to check. + */ + public static boolean typeMatches(Class<?> type, EclipseNode node, TypeReference typeRef) { if (typeRef == null || typeRef.getTypeName() == null) return false; String typeName = toQualifiedName(typeRef.getTypeName()); |