]> source.dussan.org Git - aspectj.git/commitdiff
PR336997
authoraclement <aclement>
Fri, 11 Feb 2011 19:03:13 +0000 (19:03 +0000)
committeraclement <aclement>
Fri, 11 Feb 2011 19:03:13 +0000 (19:03 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/TypeVariable.java
org.aspectj.matcher/src/org/aspectj/weaver/TypeVariableReferenceType.java
org.aspectj.matcher/src/org/aspectj/weaver/World.java

index 85678a906206e7308ccf41a27d14b89e5949c10b..d6ec997f6276930eaad89a77b03b4c14197447ff 100644 (file)
@@ -41,7 +41,7 @@ public class TypeVariable {
        private int declaringElementKind = UNKNOWN;
        private TypeVariableDeclaringElement declaringElement;
        // whether or not the bounds of this type variable have been resolved
-       private boolean isResolved = false;
+       public boolean isResolved = false;
        // Is this type variable in the process of being resolved (allows for something self-referential like Enum)
        private boolean beingResolved = false;
 
@@ -212,9 +212,9 @@ public class TypeVariable {
 
        // only used when resolving
        public void setAdditionalInterfaceBounds(UnresolvedType[] superInterfaces) {
-               if (isResolved) {
-                       throw new IllegalStateException("Why set this late?");
-               }
+               // if (isResolved) {
+               // throw new IllegalStateException("Why set this late?");
+               // }
                this.firstbound = null;
                this.superInterfaces = superInterfaces;
        }
index 24e028e7f44cedf8c721766b3981929e86ac42ed..76c5a2458b9aae064baf944d960d41daf1d86261 100644 (file)
@@ -68,7 +68,8 @@ public class TypeVariableReferenceType extends ReferenceType implements TypeVari
        }
 
        public TypeVariable getTypeVariable() {
-               // if (!fixedUp) throw new BCException("ARGH"); // fix it up now?
+               // if (!fixedUp)
+               // throw new BCException("ARGH"); // fix it up now?
                return typeVariable;
        }
 
@@ -132,4 +133,20 @@ public class TypeVariableReferenceType extends ReferenceType implements TypeVari
                return (ReferenceType) typeVariable.resolve(world).getUpperBound();
        }
 
+       /**
+        * resolve the type variable we are managing and then return this object. 'this' is already a ResolvedType but the type variable
+        * may transition from a not-resolved to a resolved state.
+        */
+       public ResolvedType resolve(World world) {
+               typeVariable.resolve(world);
+               return this;
+       }
+
+       /**
+        * @return true if the type variable this reference is managing is resolved
+        */
+       public boolean isTypeVariableResolved() {
+               return typeVariable.isResolved;
+       }
+
 }
index ce52537c0614a4a24dd2f027da172ab95dc0a09e..779804c2f4824743aa71d88e07ff72832dc7f738 100644 (file)
@@ -264,7 +264,11 @@ public abstract class World implements Dump.INode {
                if (ty instanceof ResolvedType) {
                        ResolvedType rty = (ResolvedType) ty;
                        rty = resolve(rty);
-                       return rty;
+                       // A TypeVariableReferenceType may look like it is resolved (it extends ResolvedType) but the internal
+                       // type variable may not yet have been resolved
+                       if (!rty.isTypeVariableReference() || ((TypeVariableReferenceType) rty).isTypeVariableResolved()) {
+                               return rty;
+                       }
                }
 
                // dispatch back to the type variable reference to resolve its