use of spoon.reflect.declaration.CtExecutable in project spoon by INRIA.
the class MethodTypingContext method adaptTypeForNewMethod.
private CtTypeReference<?> adaptTypeForNewMethod(CtTypeReference<?> typeRef) {
if (typeRef == null) {
return null;
}
if (typeRef instanceof CtTypeParameterReference) {
CtTypeParameterReference typeParamRef = (CtTypeParameterReference) typeRef;
CtTypeParameter typeParam = typeParamRef.getDeclaration();
if (typeParam == null) {
throw new SpoonException("Declaration of the CtTypeParameter should not be null.");
}
if (typeParam.getTypeParameterDeclarer() instanceof CtExecutable) {
// the parameter is declared in scope of Method or Constructor
return typeRef.clone();
}
}
// it is not type reference of scopeMethod. Adapt it using classTypingContext
return classTypingContext.adaptType(typeRef);
}
Aggregations