From 6b1cad1c221791c4a6070d4a581d526eb918eb77 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 2 Nov 2009 17:10:15 +0000 Subject: [PATCH] 293620: fast exit before annotation matching if type match doesnt pass --- .../weaver/patterns/ExactTypePattern.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactTypePattern.java index 1b967fea8..c9a1a84cb 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -31,13 +31,14 @@ import org.aspectj.weaver.World; public class ExactTypePattern extends TypePattern { protected UnresolvedType type; + protected transient ResolvedType resolvedType; - public static final Map primitiveTypesMap; - public static final Map boxedPrimitivesMap; - private static final Map boxedTypesMap; + public static final Map> primitiveTypesMap; + public static final Map> boxedPrimitivesMap; + private static final Map> boxedTypesMap; static { - primitiveTypesMap = new HashMap(); + primitiveTypesMap = new HashMap>(); primitiveTypesMap.put("int", int.class); primitiveTypesMap.put("short", short.class); primitiveTypesMap.put("long", long.class); @@ -46,7 +47,7 @@ public class ExactTypePattern extends TypePattern { primitiveTypesMap.put("float", float.class); primitiveTypesMap.put("double", double.class); - boxedPrimitivesMap = new HashMap(); + boxedPrimitivesMap = new HashMap>(); boxedPrimitivesMap.put("java.lang.Integer", Integer.class); boxedPrimitivesMap.put("java.lang.Short", Short.class); boxedPrimitivesMap.put("java.lang.Long", Long.class); @@ -55,7 +56,7 @@ public class ExactTypePattern extends TypePattern { boxedPrimitivesMap.put("java.lang.Float", Float.class); boxedPrimitivesMap.put("java.lang.Double", Double.class); - boxedTypesMap = new HashMap(); + boxedTypesMap = new HashMap>(); boxedTypesMap.put("int", Integer.class); boxedTypesMap.put("short", Short.class); boxedTypesMap.put("long", Long.class); @@ -126,6 +127,9 @@ public class ExactTypePattern extends TypePattern { if (!typeMatch && matchType.isTypeVariableReference()) { typeMatch = matchesTypeVariable((TypeVariableReferenceType) matchType); } + if (!typeMatch) { + return false; + } annotationPattern.resolve(matchType.getWorld()); boolean annMatch = false; if (matchType.temporaryAnnotationTypes != null) { @@ -165,6 +169,13 @@ public class ExactTypePattern extends TypePattern { return type; } + public ResolvedType getResolvedExactType(World world) { + if (resolvedType == null) { + resolvedType = world.resolve(type); + } + return resolvedType; + } + // true if (matchType instanceof this.type) @Override public FuzzyBoolean matchesInstanceof(ResolvedType matchType) { -- 2.39.5