use of spoon.reflect.declaration.CtConstructor in project spoon by INRIA.
the class MethodTypingContext method setExecutableReference.
public MethodTypingContext setExecutableReference(CtExecutableReference<?> execRef) {
if (classTypingContext == null) {
CtTypeReference<?> declaringTypeRef = execRef.getDeclaringType();
if (declaringTypeRef != null) {
classTypingContext = new ClassTypingContext(declaringTypeRef);
}
}
CtExecutable<?> exec = execRef.getExecutableDeclaration();
if (exec == null) {
throw new SpoonException("Cannot create MethodTypingContext from CtExecutable of CtExecutableReference is null");
}
if (exec instanceof CtMethod<?>) {
setMethod((CtMethod<?>) exec);
} else if (exec instanceof CtConstructor<?>) {
setConstructor((CtConstructor<?>) exec);
} else {
throw new SpoonException("Cannot create MethodTypingContext from " + exec.getClass().getName());
}
this.actualTypeArguments = execRef.getActualTypeArguments();
return this;
}
Aggregations