use of spoon.support.visitor.java.internal.TypeReferenceRuntimeBuilderContext in project spoon by INRIA.
the class JavaReflectionTreeBuilder method visitInterfaceReference.
@Override
public <T> void visitInterfaceReference(Class<T> anInterface) {
final CtTypeReference<Object> typeReference = factory.Core().createTypeReference();
typeReference.setSimpleName(anInterface.getSimpleName());
enter(new TypeReferenceRuntimeBuilderContext(typeReference));
super.visitInterfaceReference(anInterface);
exit();
contexts.peek().addInterfaceReference(typeReference);
}
use of spoon.support.visitor.java.internal.TypeReferenceRuntimeBuilderContext in project spoon by INRIA.
the class JavaReflectionTreeBuilder method visitType.
@Override
public void visitType(WildcardType type) {
final CtWildcardReference wildcard = factory.Core().createWildcardReference();
wildcard.setUpper(type.getUpperBounds() != null && !type.getUpperBounds()[0].equals(Object.class));
enter(new TypeReferenceRuntimeBuilderContext(wildcard));
super.visitType(type);
exit();
contexts.peek().addTypeName(wildcard);
}
use of spoon.support.visitor.java.internal.TypeReferenceRuntimeBuilderContext in project spoon by INRIA.
the class JavaReflectionTreeBuilder method visitType.
@Override
public void visitType(Type type) {
CtTypeReference<?> ctTypeReference;
if (type instanceof TypeVariable) {
ctTypeReference = factory.Core().createTypeParameterReference();
} else {
ctTypeReference = factory.Core().createTypeReference();
}
enter(new TypeReferenceRuntimeBuilderContext(ctTypeReference));
ctTypeReference.setSimpleName(getTypeName(type));
super.visitType(type);
exit();
contexts.peek().addTypeName(ctTypeReference);
}
use of spoon.support.visitor.java.internal.TypeReferenceRuntimeBuilderContext in project spoon by INRIA.
the class JavaReflectionTreeBuilder method visitClassReference.
@Override
public <T> void visitClassReference(Class<T> clazz) {
final CtTypeReference<Object> typeReference = factory.Core().createTypeReference();
typeReference.setSimpleName(clazz.getSimpleName());
enter(new TypeReferenceRuntimeBuilderContext(typeReference));
super.visitClassReference(clazz);
exit();
contexts.peek().addClassReference(typeReference);
}
use of spoon.support.visitor.java.internal.TypeReferenceRuntimeBuilderContext in project spoon by INRIA.
the class JavaReflectionTreeBuilder method visitType.
@Override
public void visitType(ParameterizedType type) {
final CtTypeReference<?> ctTypeReference = factory.Core().createTypeReference();
enter(new TypeReferenceRuntimeBuilderContext(ctTypeReference) {
@Override
public void addClassReference(CtTypeReference<?> typeReference) {
ctTypeReference.setSimpleName(typeReference.getSimpleName());
ctTypeReference.setPackage(typeReference.getPackage());
ctTypeReference.setDeclaringType(typeReference.getDeclaringType());
ctTypeReference.setActualTypeArguments(typeReference.getActualTypeArguments());
ctTypeReference.setAnnotations(typeReference.getAnnotations());
}
@Override
public void addType(CtType<?> aType) {
}
});
super.visitType(type);
exit();
contexts.peek().addTypeName(ctTypeReference);
}
Aggregations