Could it be that the output is java.util.ArrayList<String> and you do not see the <String> , since your browser interprets it as an unknown HTML tag?
You will need to exit < for HTML output.
If this is not a problem, just show the code so that we can reproduce the problem.
After looking at your example, I can reproduce it using this document:
package de.fencing_game.paul.examples.doclet; import com.sun.javadoc.*; import java.util.ArrayList; public class GenericTestDoclet<Y> extends Doclet { public ArrayList<? extends Y> stringList; public GenericTestDoclet() { } public ArrayList<? extends Y> getList() { return stringList; } public void printType(Type fieldType, DocErrorReporter err) { err.printNotice("type: " + fieldType); if (fieldType.asParameterizedType() != null) { ParameterizedType paramType = fieldType.asParameterizedType(); err.printNotice("paramType:" + paramType); String qualiName = paramType.qualifiedTypeName(); err.printNotice("qualiName: " + qualiName); String typeName = fieldType.asParameterizedType().typeName(); err.printNotice("typeName: " + typeName); Type[] parameters = paramType.typeArguments(); err.printNotice("parameters.length: " + parameters.length); for(Type p : parameters) { err.printNotice("param: " + p); } } err.printNotice(""); } public void listFields(ClassDoc classDoc, DocErrorReporter err) { FieldDoc[] fields = classDoc.fields(); for (int k = 0; k < fields.length; k++) { err.printNotice("field: " + fields[k]); Type fieldType = fields[k].type(); printType(fieldType, err); } } public void listMethods(ClassDoc classDoc, DocErrorReporter err) { MethodDoc[] methods = classDoc.methods(); for (int k = 0; k < methods.length; k++) { err.printNotice("method: " + methods[k]); Type returnType = methods[k].returnType(); printType(returnType, err); } } public static boolean start(RootDoc root) { GenericTestDoclet<?> d = new GenericTestDoclet<Integer>(); for(ClassDoc clazz : root.classes()) { d.listFields(clazz, root); d.listMethods(clazz, root); } return true; } }
Exit, if applied by itself:
field: de.fencing_game.paul.examples.doclet.GenericTestDoclet.stringList type: java.util.ArrayList paramType:java.util.ArrayList qualiName: java.util.ArrayList typeName: ArrayList parameters.length: 0 method: de.fencing_game.paul.examples.doclet.GenericTestDoclet.getList() type: java.util.ArrayList paramType:java.util.ArrayList qualiName: java.util.ArrayList typeName: ArrayList parameters.length: 0 [more methods omitted]
This shows that there can also be light-hearted return types.
I wanted to say that I already used this method to print the type name recursively , but this shows that my LaTeX-Doclet is not actually even using the recursive method that I created (instead, the types are printed from the type compiler tree ).
But one way or another, this should be possible, because somehow the Standard Doclet tunes to create the correct output .
PaΕlo Ebermann
source share