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.

This commit is contained in:
Reinier Zwitserloot committed 2011-08-15 22:16:54 +02:00
1 parent f4cce85965
commit a85023b919
1 file changed
+4 -1
+4 -1
View File
@@ -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();