Source:
<code>public static void typeToString(final TypeMirror type, final StringBuilder result, final char innerClassSeparator) { type.accept(new SimpleTypeVisitor6<Void, Void>() { @Override public Void visitDeclared(DeclaredType declaredType, Void v) { TypeElement typeElement = (TypeElement) declaredType.asElement(); rawTypeToString(result, typeElement, innerClassSeparator); List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); if (!typeArguments.isEmpty()) { result.append("<"); for (int i = 0; i < typeArguments.size(); i++) { if (i != 0) { result.append(", "); } typeToString(typeArguments.get(i), result, innerClassSeparator); } result.append(">"); } return null; } @Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) { result.append(box((PrimitiveType) type).getName()); return null; } @Override public Void visitArray(ArrayType arrayType, Void v) { TypeMirror type = arrayType.getComponentType(); if (type instanceof PrimitiveType) { result.append(type.toString()); } else { typeToString(arrayType.getComponentType(), result, innerClassSeparator); } result.append("[]"); return null; } @Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) { result.append(typeVariable.asElement().getSimpleName()); return null; } @Override public Void visitError(ErrorType errorType, Void v) { if ("<any>".equals(errorType.toString())) { <START> throw new CodeGenerationIncompleteException("Type " + errorType.toString() + " missing."); <END> } result.append(errorType.toString()); return null; } @Override protected Void defaultAction(TypeMirror typeMirror, Void v) { throw new UnsupportedOperationException( "Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror); } }, null); }</code><technical_language>error message is meaningful here; Type <any> missing.</technical_language>

Target:
public static void typeToString(final TypeMirror type, final StringBuilder result, final char innerClassSeparator) { type.accept(new SimpleTypeVisitor6<Void, Void>() { @Override public Void visitDeclared(DeclaredType declaredType, Void v) { TypeElement typeElement = (TypeElement) declaredType.asElement(); rawTypeToString(result, typeElement, innerClassSeparator); List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); if (!typeArguments.isEmpty()) { result.append("<"); for (int i = 0; i < typeArguments.size(); i++) { if (i != 0) { result.append(", "); } typeToString(typeArguments.get(i), result, innerClassSeparator); } result.append(">"); } return null; } @Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) { result.append(box((PrimitiveType) type).getName()); return null; } @Override public Void visitArray(ArrayType arrayType, Void v) { TypeMirror type = arrayType.getComponentType(); if (type instanceof PrimitiveType) { result.append(type.toString()); } else { typeToString(arrayType.getComponentType(), result, innerClassSeparator); } result.append("[]"); return null; } @Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) { result.append(typeVariable.asElement().getSimpleName()); return null; } @Override public Void visitError(ErrorType errorType, Void v) { if ("<any>".equals(errorType.toString())) { throw new CodeGenerationIncompleteException( "Type reported as <any> is likely a not-yet generated parameterized type."); } result.append(errorType.toString()); return null; } @Override protected Void defaultAction(TypeMirror typeMirror, Void v) { throw new UnsupportedOperationException( "Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror); } }, null); }