From: aclement Date: Thu, 10 Dec 2009 20:03:42 +0000 (+0000) Subject: 296734: various optimizations for LTW and aop.xml include/exclude processing X-Git-Tag: V1_6_7~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e602434aeeef6242663b5bfdd254843c9fefbf0;p=aspectj.git 296734: various optimizations for LTW and aop.xml include/exclude processing --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java index 4ee0d68a0..10ffc7fc2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java @@ -406,9 +406,11 @@ public class ReferenceType extends ResolvedType { return true; } } + if (this == other) { return true; } + if (this.getSignature().equals(ResolvedType.OBJECT.getSignature())) { return true; } @@ -428,11 +430,6 @@ public class ReferenceType extends ResolvedType { return true; } } - // if (this.isParameterizedType() && other.isRawType()) { - // if (((ReferenceType) this.getRawType()).isAssignableFrom(other.getGenericType())) { - // return true; - // } - // } if (this.isParameterizedType()) { // look at wildcards... @@ -555,8 +552,15 @@ public class ReferenceType extends ResolvedType { return false; } - for (Iterator i = other.getDirectSupertypes(); i.hasNext();) { - if (this.isAssignableFrom((ResolvedType) i.next(), allowMissing)) { + ResolvedType[] interfaces = other.getDeclaredInterfaces(); + for (ResolvedType intface : interfaces) { + if (this.isAssignableFrom(intface, allowMissing)) { + return true; + } + } + ResolvedType superclass = other.getSuperclass(); + if (superclass != null) { + if (this.isAssignableFrom(superclass, allowMissing)) { return true; } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index 963b0a86b..8675423bd 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -1749,7 +1749,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl interTypeMungers.add(munger); } - /** * 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. @@ -2204,21 +2203,23 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public boolean isTopmostImplementor(ResolvedType interfaceType) { + boolean b = true; if (isInterface()) { - return false; - } - if (!interfaceType.isAssignableFrom(this, true)) { - return false; - } + b = false; + } else if (!interfaceType.isAssignableFrom(this, true)) { + b = false; + } else // check that I'm truly the topmost implementor if (this.getSuperclass().isMissing()) { - return true; // we don't know anything about supertype, and it can't - } + b = true; // we don't know anything about supertype, and it can't + } else // be exposed to weaver if (interfaceType.isAssignableFrom(this.getSuperclass(), true)) { - return false; + b = false; } - return true; + // System.out.println("is " + getName() + " topmostimplementor of " + interfaceType + "? " + b); + // System.err.println("Was topmostimplementor? "+interfaceType.getName()+" "+b); + return b; } public ResolvedType getTopmostImplementor(ResolvedType interfaceType) { @@ -2241,14 +2242,14 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl if (getSuperclass() != null) { ret.addAll(getSuperclass().getExposedPointcuts()); } - - for (ResolvedType type: getDeclaredInterfaces()) { + + for (ResolvedType type : getDeclaredInterfaces()) { addPointcutsResolvingConflicts(ret, Arrays.asList(type.getDeclaredPointcuts()), false); } - + addPointcutsResolvingConflicts(ret, Arrays.asList(getDeclaredPointcuts()), true); - - for (ResolvedMember member: ret) { + + for (ResolvedMember member : ret) { ResolvedPointcutDefinition inherited = (ResolvedPointcutDefinition) member; if (inherited != null && inherited.isAbstract()) { if (!this.isAbstract()) { @@ -2266,11 +2267,11 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl ResolvedPointcutDefinition toAdd = (ResolvedPointcutDefinition) i.next(); for (Iterator j = acc.iterator(); j.hasNext();) { ResolvedPointcutDefinition existing = (ResolvedPointcutDefinition) j.next(); - if (toAdd==null || existing==null || existing == toAdd) { + if (toAdd == null || existing == null || existing == toAdd) { continue; } UnresolvedType pointcutDeclaringTypeUT = existing.getDeclaringType(); - if (pointcutDeclaringTypeUT!=null) { + if (pointcutDeclaringTypeUT != null) { ResolvedType pointcutDeclaringType = pointcutDeclaringTypeUT.resolve(getWorld()); if (!isVisible(existing.getModifiers(), pointcutDeclaringType, this)) { // if they intended to override it but it is not visible, @@ -2278,7 +2279,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl if (existing.isAbstract() && conflictingSignature(existing, toAdd)) { getWorld().showMessage( IMessage.ERROR, - WeaverMessages.format(WeaverMessages.POINTCUT_NOT_VISIBLE, existing.getDeclaringType().getName() + WeaverMessages.format(WeaverMessages.POINTCUT_NOT_VISIBLE, existing.getDeclaringType() + .getName() + "." + existing.getName() + "()", this.getName()), toAdd.getSourceLocation(), null); j.remove(); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java index b29c2f1cc..e132ad07a 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java @@ -583,6 +583,16 @@ public abstract class World implements Dump.INode { return declaring.lookupSyntheticMember(member); } + private boolean allLintIgnored = false; + + public void setAllLintIgnored() { + allLintIgnored = true; + } + + public boolean areAllLintIgnored() { + return allLintIgnored; + } + public abstract IWeavingSupport getWeavingSupport(); /** @@ -907,7 +917,7 @@ public abstract class World implements Dump.INode { * Map of types in the world, can have 'references' to expendable ones which can be garbage collected to recover memory. An * expendable type is a reference type that is not exposed to the weaver (ie just pulled in for type resolution purposes). */ - protected static class TypeMap { + public static class TypeMap { private static boolean debug = false; @@ -947,6 +957,16 @@ public abstract class World implements Dump.INode { // INFO); } + // For testing + public Map getExpendableMap() { + return expendableMap; + } + + // For testing + public Map getMainMap() { + return tMap; + } + /** * Go through any types added during the previous file weave. If any are suitable for demotion, then put them in the * expendable map where GC can claim them at some point later. Demotion means: the type is not an aspect, the type is not