From: aclement Date: Mon, 13 Jun 2011 18:20:39 +0000 (+0000) Subject: type demotion fixes. -Xset:avoidFinal=true to avoid final methods for around infra... X-Git-Tag: V1_6_12M2~83 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ba10175fffd15edec820de7db0ce76d900b77722;p=aspectj.git type demotion fixes. -Xset:avoidFinal=true to avoid final methods for around infra methods --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ArrayReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ArrayReferenceType.java index 21af1b8b2..aa4fa55c0 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ArrayReferenceType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ArrayReferenceType.java @@ -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; + } + } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index c13f8afe3..1d933a5d8 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -2773,4 +2773,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public int getCompilerVersion() { return WeaverVersionInfo.getCurrentWeaverMajorVersion(); } + + public boolean isPrimitiveArray() { + return false; + } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java index 5a57c5ef3..f98dd6f94 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java @@ -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