]> source.dussan.org Git - aspectj.git/commitdiff
see pr112105: tidyup
authoraclement <aclement>
Tue, 18 Oct 2005 08:21:21 +0000 (08:21 +0000)
committeraclement <aclement>
Tue, 18 Oct 2005 08:21:21 +0000 (08:21 +0000)
weaver/src/org/aspectj/weaver/ResolvedType.java
weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java

index ae18931b2f8611a00082cee6c0c9280f1556bfe7..1f931754e33ff143805932637e06b69eed2b0b75 100644 (file)
@@ -1273,7 +1273,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
      *
      * returns null if it can't be found.
      */
-    public ResolvedType discoverActualOccurenceOfTypeInHierarchy(ResolvedType lookingFor) {
+    public ResolvedType discoverActualOccurrenceOfTypeInHierarchy(ResolvedType lookingFor) {
             if (!lookingFor.isGenericType())
                     throw new BCException("assertion failed: method should only be called with generic type, but "+lookingFor+" is "+lookingFor.typeKind);
 
@@ -1288,10 +1288,10 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
             for (int i = 0; i < superIs.length; i++) {
                     ResolvedType superI = superIs[i];
                     if (superI.genericTypeEquals(lookingFor)) return superI;
-                    ResolvedType checkTheSuperI = discoverActualOccurenceOfTypeInHierarchy(lookingFor);
+                    ResolvedType checkTheSuperI = discoverActualOccurrenceOfTypeInHierarchy(lookingFor);
                     if (checkTheSuperI!=null) return checkTheSuperI;
             }
-            return discoverActualOccurenceOfTypeInHierarchy(superT);
+            return discoverActualOccurrenceOfTypeInHierarchy(superT);
     }
 
     /**
@@ -1315,17 +1315,17 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                member.resolve(world); // Ensure all parts of the member are resolved
                if (debug) System.err.println("  Actual target ontype: "+onType+"  ("+onType.typeKind+")");
                // quickly find the targettype in the type hierarchy for this type (it will be either RAW or PARAMETERIZED)
-               ResolvedType actualTarget = discoverActualOccurenceOfTypeInHierarchy(onType);
+               ResolvedType actualTarget = discoverActualOccurrenceOfTypeInHierarchy(onType);
                if (actualTarget==null)
                        throw new BCException("assertion failed: asked "+this+" for occurrence of "+onType+" in its hierarchy??");
        
                // only bind the tvars if its a parameterized type or the raw type (in which case they collapse to bounds) - don't do it for generic types ;)
                if (!actualTarget.isGenericType()) {
-                   if (debug) System.err.println("Occurence in "+this+" is actually "+actualTarget+"  ("+actualTarget.typeKind+")");
+                   if (debug) System.err.println("Occurrence in "+this+" is actually "+actualTarget+"  ("+actualTarget.typeKind+")");
                    // parameterize the signature
-                   ResolvedMember newOne = member.parameterizedWith(actualTarget.getTypeParameters(),onType,actualTarget.isParameterizedType());
+                   // ResolvedMember newOne = member.parameterizedWith(actualTarget.getTypeParameters(),onType,actualTarget.isParameterizedType());
                    munger = munger.parameterizedFor(actualTarget);
-                   if (debug) System.err.println("New sig: "+newOne);
+                   if (debug) System.err.println("New sig: "+munger.getSignature());
                    
                }
                if (debug) System.err.println("=====================================");
@@ -1927,7 +1927,9 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                        
                        for (int i = 0; i < typeParameters.length; i++) {
                                UnresolvedType aType = (ResolvedType)typeParameters[i];
-                               if (aType.isTypeVariableReference()  && ((TypeVariableReference)aType).getTypeVariable().getDeclaringElementKind()==TypeVariable.METHOD) {
+                               if (aType.isTypeVariableReference()  && 
+                               // assume the worst - if its definetly not a type declared one, it could be anything
+                                               ((TypeVariableReference)aType).getTypeVariable().getDeclaringElementKind()!=TypeVariable.TYPE) {
                                        parameterizedWithAMemberTypeVariable = FuzzyBoolean.YES;
                                        return true;
                                }
index 65c109dc17888c5ceb337fc732d2585e6bb7d18a..d398a97af4fa4677badc6c30066de2f005997474 100644 (file)
@@ -45,13 +45,13 @@ public class UnresolvedTypeVariableReferenceType extends UnresolvedType implemen
                TypeVariableReferenceType tvrt    = null;
                if (typeVariableScope == null) {
                        // throw new BCException("There is no scope in which to lookup type variables!");
-                       // SAUSAGES correct thing to do is go bang, but to limp along, lets cope with the scope missing
+                       // FIXME asc correct thing to do is go bang, but to limp along, lets cope with the scope missing
                        resolvedTypeVariable = typeVariable.resolve(world);
                        tvrt = new TypeVariableReferenceType(resolvedTypeVariable,world);
                } else {
                    boolean foundOK = false;
                        resolvedTypeVariable = typeVariableScope.getTypeVariableNamed(typeVariable.getName());
-                       // SAUSAGES remove this when the shared type var stuff is sorted
+                       // FIXME asc remove this when the shared type var stuff is sorted
                        if (resolvedTypeVariable == null) {
                                resolvedTypeVariable = typeVariable.resolve(world);
                        } else {
@@ -62,33 +62,8 @@ public class UnresolvedTypeVariableReferenceType extends UnresolvedType implemen
                }
                
                return tvrt;
-//             // SAUSAGES should really be resolved in a scope, or you won't get the type variable you really want!
-//             //throw new BCException("NO - UnresolvedTypeVariableReferenceTypes must be resolved in a type variable scope");
-//             if (typeVariable == null) {
-//                 throw new BCException("Cannot resolve this type variable reference, the type variable has not been set!");
-//             }
-//             typeVariable.resolve(world);
-//             return new TypeVariableReferenceType(typeVariable,world);
        }
        
-//     public ResolvedType resolve(World world,TypeVariableDeclaringElement tvde) {
-//             if (typeVariable == null) {
-//                     throw new BCException("Cannot resolve this type variable reference, the type variable has not been set!");
-//             }
-//             
-//             // SAUSAGES temporary whilst the ITD logic gets sorted out
-//             if (tvde == null) return new TypeVariableReferenceType(typeVariable.resolve(world),world);
-//             
-//             TypeVariable resolvedTypeVariable = tvde.getTypeVariableNamed(typeVariable.getName());
-//             if (resolvedTypeVariable == null) {
-//                     resolvedTypeVariable = typeVariable.resolve(world);
-//                     // SAUSAGES put this in once ITDs remember the complex shared type var stuff
-//                     // throw new BCException("Could not locate type variable '"+typeVariable.getName()+"' during resolution, scope was: "+tvde);
-//             }
-//             TypeVariableReferenceType tvrt = new TypeVariableReferenceType(resolvedTypeVariable,world);
-//             tvrt.fixedUp = true;
-//             return tvrt;
-//     }
        
        public boolean isTypeVariableReference() {
                return true;