private static TypeMirror getErasuredType(TypeMirror typeMirror, TypeElement owner) { if (typeMirror.equals(TypeKind.TYPEVAR)) { TypeMirror ensuredType = ProcessorUtils.erasure(owner, (TypeVariable) typeMirror); if (ensuredType != null) { return ensuredType; } } return typeMirror; } }
public static TypeMirror erasure(TypeElement typeElement, TypeVariable typeVar) { return erasure(typeElement, typeVar.asElement().getSimpleName().toString()); }
break; case TYPEVAR: TypeMirror erasure = ProcessorUtils.erasure(typeElement, typeMirror.toString()); if (erasure == null) { for (TypeParameterElement parameter: typeElement.getTypeParameters()) {
private MutableTypeMirror erasure(TypeMirror type, TypeElement owner) { switch (type.getKind()) { case TYPEVAR: TypeMirror erasure = ProcessorUtils.erasure(owner, (TypeVariable) type); if (erasure == null) { return processingEnv.getTypeUtils().getTypeVariable(((TypeVariable) type).asElement().getSimpleName().toString()); } return processingEnv.getTypeUtils().toMutableType(erasure); case DECLARED: DeclaredType declaredType = (DeclaredType)type; return processingEnv.getTypeUtils().toMutableType(declaredType).stripTypeParametersTypes(); default: return processingEnv.getTypeUtils().toMutableType(type); } }
TypeMirror erasuredReturnType = ProcessorUtils.erasure(owner, (TypeVariable) returnType); if (erasuredReturnType != null) { returnType = erasuredReturnType;
private void printType(TypeMirror typeMirror, TypeElement owner) { switch (typeMirror.getKind()) { case TYPEVAR: TypeVariable variable = (TypeVariable) typeMirror; if (owner == null) { if (variable.getUpperBound() != null) { printWriter.print(variable.getUpperBound()); } else if (variable.getLowerBound() != null) { printWriter.print(variable.getLowerBound()); } else { printWriter.print(variable.asElement().getSimpleName()); } } else { TypeMirror erasure = ProcessorUtils.erasure(owner, variable); if (erasure == null) { printWriter.print(processingEnv.getTypeUtils().getTypeVariable(((TypeVariable) variable).asElement().getSimpleName().toString())); } else { printWriter.print(erasure); } } break; default: printWriter.print(typeMirror); } } }
TypeMirror erasuredTypeVariable = ProcessorUtils.erasure(owner, mutableTypeVariable.getVariable()); if (erasuredTypeVariable != null) { return processingEnv.getTypeUtils().getTypeVariable(null, processingEnv.getTypeUtils().toMutableType(erasuredTypeVariable));
ProcessorUtils.erasure(processingEnv.getElementUtils().getTypeElement(configurationTypeElement.getDomain().getCanonicalName()), (TypeVariable)returnIdType);