]> source.dussan.org Git - aspectj.git/commitdiff
type demotion fixes. -Xset:avoidFinal=true to avoid final methods for around infra...
authoraclement <aclement>
Mon, 13 Jun 2011 18:20:39 +0000 (18:20 +0000)
committeraclement <aclement>
Mon, 13 Jun 2011 18:20:39 +0000 (18:20 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/ArrayReferenceType.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
org.aspectj.matcher/src/org/aspectj/weaver/World.java

index 21af1b8b280a15938aa7e44440f0174fd3426aeb..aa4fa55c03d40c9f174c22c914ab1eada4fd0d77 100644 (file)
@@ -182,6 +182,11 @@ public class ArrayReferenceType extends ReferenceType {
                return false;
        }
 
+       @Override
+       public boolean isExposedToWeaver() {
+               return false;
+       }
+
        public boolean canAnnotationTargetType() {
                return false;
        }
@@ -193,4 +198,14 @@ public class ArrayReferenceType extends ReferenceType {
        public boolean isAnnotationWithRuntimeRetention() {
                return false;
        }
+
+       public boolean isPrimitiveArray() {
+               if (componentType.isPrimitiveType()) {
+                       return true;
+               } else if (componentType.isArray()) {
+                       return componentType.isPrimitiveArray();
+               } else {
+                       return false;
+               }
+       }
 }
index c13f8afe3de788a9e2e9d5ed8f35ee8bb453127a..1d933a5d859e7c501fc4500c29e8fdbeafd6856f 100644 (file)
@@ -2773,4 +2773,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
        public int getCompilerVersion() {
                return WeaverVersionInfo.getCurrentWeaverMajorVersion();
        }
+
+       public boolean isPrimitiveArray() {
+               return false;
+       }
 }
index 5a57c5ef331c8db4805ef4ed03634c4f57a77410..f98dd6f943429a7840947f9ffa7c336fe4a46b68 100644 (file)
@@ -140,6 +140,7 @@ public abstract class World implements Dump.INode {
 
        // Minimal Model controls whether model entities that are not involved in relationships are deleted post-build
        private boolean minimalModel = false;
+       private boolean useFinal = true;
        private boolean targettingRuntime1_6_10 = false;
 
        private boolean completeBinaryTypes = false;
@@ -529,7 +530,7 @@ public abstract class World implements Dump.INode {
 
                if (genericType != null) {
                        genericType.world = this;
-                       ((ReferenceType)genericType).addDependentType((ReferenceType)rawType);
+                       ((ReferenceType) genericType).addDependentType((ReferenceType) rawType);
                        return genericType;
                } else {
                        // Fault in the generic that underpins the raw type ;)
@@ -813,6 +814,10 @@ public abstract class World implements Dump.INode {
                Xpinpoint = b;
        }
 
+       public boolean useFinal() {
+               return useFinal;
+       }
+
        public boolean isMinimalModel() {
                ensureAdvancedConfigurationProcessed();
                return minimalModel;
@@ -901,6 +906,8 @@ public abstract class World implements Dump.INode {
                return extraConfiguration;
        }
 
+       public final static String xsetAVOID_FINAL = "avoidFinal"; // default true
+
        public final static String xsetWEAVE_JAVA_PACKAGES = "weaveJavaPackages"; // default
        // false
        // -
@@ -1328,6 +1335,15 @@ public abstract class World implements Dump.INode {
                        }
                }
 
+               public void demote(ResolvedType type) {
+                       String key = type.getSignature();
+                       if (debugDemotion) {
+                               addedSinceLastDemote.remove(key);
+                       }
+                       tMap.remove(key);
+                       insertInExpendableMap(key, type);
+               }
+
                // public ResolvedType[] getAllTypes() {
                // List/* ResolvedType */results = new ArrayList();
                //
@@ -1514,6 +1530,11 @@ public abstract class World implements Dump.INode {
                                        itdVersion = 1;
                                }
 
+                               s = p.getProperty(xsetAVOID_FINAL, "false");
+                               if (s.equalsIgnoreCase("true")) {
+                                       useFinal = false; // if avoidFinal=true, then set useFinal to false
+                               }
+
                                s = p.getProperty(xsetMINIMAL_MODEL, "false");
                                if (s.equalsIgnoreCase("true")) {
                                        minimalModel = true;
@@ -1760,7 +1781,8 @@ public abstract class World implements Dump.INode {
         * Reference types we don't intend to weave may be ejected from the cache if we need the space.
         */
        protected boolean isExpendable(ResolvedType type) {
-               return (!type.equals(UnresolvedType.OBJECT) && (!type.isExposedToWeaver()) && (!type.isPrimitiveType()));
+               return !type.equals(UnresolvedType.OBJECT) && !type.isExposedToWeaver() && !type.isPrimitiveType()
+                               && !type.isPrimitiveArray();
        }
 
        // map from aspect > excluded types