]> source.dussan.org Git - aspectj.git/commitdiff
296734: various optimizations for LTW and aop.xml include/exclude processing
authoraclement <aclement>
Thu, 10 Dec 2009 20:03:42 +0000 (20:03 +0000)
committeraclement <aclement>
Thu, 10 Dec 2009 20:03:42 +0000 (20:03 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
org.aspectj.matcher/src/org/aspectj/weaver/World.java

index 4ee0d68a046e6d6959ff335955c75a542d5e2b05..10ffc7fc26f8e68e4974ce8a648c6e239fad2d7b 100644 (file)
@@ -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;
                        }
                }
index 963b0a86b1c110a12c9e977e438d71f8c8e512ec..8675423bd39dc9cb00bfa1646bc4d6d7660354c8 100644 (file)
@@ -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();
                                                }
index b29c2f1cc4627ae36b1a92732434dceacb992b18..e132ad07a367bf409fdb070db6d8a9fe472cfba4 100644 (file)
@@ -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