From 45d1a33a205f44b924ef3e373cd9ce63c05fe8ec Mon Sep 17 00:00:00 2001 From: aclement Date: Sun, 8 Nov 2009 17:20:04 +0000 Subject: [PATCH] slowly merging in optimizations --- .../src/org/aspectj/weaver/ResolvedType.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index 7a47e8769..9494aa445 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -41,7 +41,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public static final ResolvedType[] EMPTY_RESOLVED_TYPE_ARRAY = new ResolvedType[0]; public static final String PARAMETERIZED_TYPE_IDENTIFIER = "P"; - // Set during a type pattern match call - this currently used to hold the + // Set temporarily during a type pattern match call - this currently used to hold the // annotations that may be attached to a type when it used as a parameter public ResolvedType[] temporaryAnnotationTypes; private ResolvedType[] resolvedTypeParams; @@ -99,8 +99,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public abstract int getModifiers(); - // return true if this resolved type couldn't be found (but we know it's - // name maybe) + // return true if this resolved type couldn't be found (but we know it's name maybe) public boolean isMissing() { return false; } @@ -394,7 +393,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } } } - if (!resolvedType.equals(ResolvedType.OBJECT)) { + // BUG? interface type superclass is Object - is that correct? + if (!resolvedType.isInterface() && !resolvedType.equals(ResolvedType.OBJECT)) { ResolvedType superType = resolvedType.getSuperclass(); if (superType != null && !superType.isMissing()) { if (!genericsAware && superType.isParameterizedOrGenericType()) { @@ -1691,10 +1691,12 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl sig = munger.getSignature(); // possibly changed when type parms filled in if (sig.getKind() == Member.METHOD) { - if (clashesWithExistingMember(munger, getMethodsWithoutIterator(false, true, false).iterator())) { + // OPTIMIZE can this be sped up? + if (clashesWithExistingMember(munger, getMethods(true, false))) { // ITDs checked below return; } if (this.isInterface()) { + // OPTIMIZE this set of methods are always the same - must we keep creating them as a list? if (clashesWithExistingMember(munger, Arrays.asList(world.getCoreType(OBJECT).getDeclaredMethods()).iterator())) { return; } @@ -1746,6 +1748,15 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl interTypeMungers.add(munger); } +// private void printIterator(String string, Iterator iterator) { +// System.out.println(">" + string); +// while (iterator.hasNext()) { +// ResolvedMember rm = iterator.next(); +// System.out.println(" " + rm); +// } +// System.out.println("<" + string); +// } + /** * Compare the type transformer with the existing members. A clash may not be an error (the ITD may be the 'default * implementation') so returning false is not always a sign of an error. -- 2.39.5