*
* 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);
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);
}
/**
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("=====================================");
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;
}
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 {
}
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;