@Override
public AbstractJType visitDeclared(DeclaredType t, Void p) {
try {
TypeElement element = (TypeElement)t.asElement();
AbstractJClass _class = ref(element);
for (TypeMirror typeArgument: t.getTypeArguments()) {
_class = _class.narrow(toJType(typeArgument, environment));
}
return _class;
} catch (ProcessingException ex) {
throw new RuntimeProcessingException(ex);
}
}
@Override
public AbstractJType visitError(ErrorType t, Void p) {
try {
throw new ErrorTypeFound();
} catch (ProcessingException ex) {
throw new RuntimeProcessingException(ex);
}
}
@Override
public AbstractJType visitTypeVariable(TypeVariable t, Void p) {
return environment.get(t.asElement().getSimpleName().toString());
}
@Override
public AbstractJType visitWildcard(WildcardType t, Void p) {
try {
TypeMirror extendsBoundMirror = t.getExtendsBound();
if (extendsBoundMirror != null) {
AbstractJClass extendsBound = (AbstractJClass)toJType(extendsBoundMirror, environment);
return extendsBound.wildcard(JTypeWildcard.EBoundMode.EXTENDS);
}
TypeMirror superBoundMirror = t.getSuperBound();
if (superBoundMirror != null) {
AbstractJClass superBound = (AbstractJClass)toJType(superBoundMirror, environment);
return superBound.wildcard(JTypeWildcard.EBoundMode.SUPER);
}
return codeModel.wildcard();
} catch (ProcessingException ex) {
throw new RuntimeProcessingException(ex);
}