Details
Description
QDox doesn't seem to correctly parse deeply nested generic type parameters. The following failing unit test should illustrate the issue:
QDoxText.java
import com.thoughtworks.qdox.JavaDocBuilder; import com.thoughtworks.qdox.model.JavaClass; import com.thoughtworks.qdox.model.JavaMethod; public class QDoxTest extends junit.framework.TestCase { final JavaDocBuilder builder = new JavaDocBuilder(); public void testReadsGenericsInGenericType() { final String sourceCode = "" + "package foo;\n" + "public static class DummyOne {\n" + " public static java.util.list<java.util.Map<? extends java.util.Set<Long>, String>> crazyType() { return null; }\n" + "}\n"; builder.addSource(new java.io.StringReader(sourceCode)); JavaClass qDoxClass = builder.getClassByName("foo.DummyOne"); JavaMethod qDoxMethod = qDoxClass.getMethods()[0]; String result = qDoxMethod.getGenericReturnType().getActualTypeArguments()[0].toGenericString(); assertEquals("java.util.Map<? extends java.util.Set<java.lang.Long>, java.lang.String>", result); } }
Activity
Robert Scholte
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Robert Scholte [ rfscholte ] |
Robert Scholte
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Fix Version/s | 2.0 [ 15636 ] | |
Resolution | Fixed [ 1 ] |
Fixed in rev.1556
Thanks for the test!
In QDox2 some signatures have changed or removed, see the revision how you should do it with the new version.