diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-08-15 22:16:54 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-08-15 22:16:54 +0200 |
commit | a85023b919928e2a57343639be1d69d15fd0c1d0 (patch) | |
tree | 96bfd04d670cafb5347575afa8c04be8913bbce5 /src/core | |
parent | f4cce859657d191b705617155f4a7547c8ece21c (diff) | |
download | lombok-a85023b919928e2a57343639be1d69d15fd0c1d0.tar.gz lombok-a85023b919928e2a57343639be1d69d15fd0c1d0.tar.bz2 lombok-a85023b919928e2a57343639be1d69d15fd0c1d0.zip |
Optimized the 'val' search; previously a fairly lengthy import list check was done for _every_ local declaration _anywhere_ in _any_ eclipse source file to see if it needed 'val' treatment. Now as a shortcut there's a check if the typeRef's last part is equal to 'val', and if not, no check is performed.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/eclipse/Eclipse.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/Eclipse.java b/src/core/lombok/eclipse/Eclipse.java index 2cb2fe33..858c2fe9 100644 --- a/src/core/lombok/eclipse/Eclipse.java +++ b/src/core/lombok/eclipse/Eclipse.java @@ -581,7 +581,10 @@ public class Eclipse { * @param typeRef A type reference to check. */ public static boolean typeMatches(Class<?> type, EclipseNode node, TypeReference typeRef) { - if (typeRef == null || typeRef.getTypeName() == null) return false; + if (typeRef == null || typeRef.getTypeName() == null || typeRef.getTypeName().length == 0) return false; + String lastPartA = new String(typeRef.getTypeName()[typeRef.getTypeName().length -1]); + String lastPartB = type.getSimpleName(); + if (!lastPartA.equals(lastPartB)) return false; String typeName = toQualifiedName(typeRef.getTypeName()); TypeLibrary library = new TypeLibrary(); |