*/
public void ensureScopeSetup() {
if (scopeSetup) return; // don't do it again
MethodScope scope = this.scope;
TypeReference ot = onType;
ReferenceBinding rb = null;
if (ot instanceof ParameterizedQualifiedTypeReference) { // pr132349
ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
if (pref.typeArguments!=null && pref.typeArguments.length!=0) {
boolean usingNonTypeVariableInITD = false;
// Check if any of them are not type variables
for (int i = 0; i < pref.typeArguments.length; i++) {
TypeReference[] refs = pref.typeArguments[i];
for (int j = 0; refs!=null && j < refs.length; j++) {
TypeBinding tb = refs[j].getTypeBindingPublic(scope.parent);
if (!tb.isTypeVariable() && !(tb instanceof ProblemReferenceBinding)) {
usingNonTypeVariableInITD = true;
}
}
}
if (usingNonTypeVariableInITD) {
scope.problemReporter().signalError(sourceStart,sourceEnd,
"Cannot make inter-type declarations on parameterized types");
// to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
this.arguments=null;
this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
this.ignoreFurtherInvestigation=true;
ReferenceBinding closestMatch = null;
rb = new ProblemReferenceBinding(ot.getParameterizedTypeName(),closestMatch,0);
onType=null;
}
}
}
// Work out the real base type
if (ot instanceof ParameterizedSingleTypeReference) {
ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) ot;
long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
ot = new SingleTypeReference(pref.token,pos);
} else if (ot instanceof ParameterizedQualifiedTypeReference) {
ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
ot = new QualifiedTypeReference(pref.tokens,new long[]{pos});//SingleTypeReference(pref.Quatoken,pos);
}
// resolve it
if (rb==null) {
rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);
}
// pr203646 - if we have ended up with the raw type, get back to the underlying generic one.
if (rb.isRawType() && rb.isMemberType()) {
// if the real target type used a type variable alias then we can do this OK, but need to switch things around, we want the generic type