QDox
  1. QDox
  2. QDOX-243

Incorrect parsing of nested generic type parameters

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.12
    • Fix Version/s: 2.0
    • Component/s: Parser
    • Labels:
      None
    • Environment:
      java 7
    • Testcase included:
      yes
    • Number of attachments :
      0

      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 ]
        Hide
        Robert Scholte added a comment -

        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.

        Show
        Robert Scholte added a comment - 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.
        Robert Scholte made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0 [ 15636 ]
        Resolution Fixed [ 1 ]
        Hide
        Tom Denley added a comment -

        Thank you for the fast turnaround.

        Is there a nightly snapshot of the trunk that I can take to try the fix out?

        Show
        Tom Denley added a comment - Thank you for the fast turnaround. Is there a nightly snapshot of the trunk that I can take to try the fix out?
        Hide
        Robert Scholte added a comment -

        I've just deployed a 2.0-SNAPSHOT to https://nexus.codehaus.org/content/repositories/snapshots/
        Feel free to try it, any feedback is welcome!

        Show
        Robert Scholte added a comment - I've just deployed a 2.0-SNAPSHOT to https://nexus.codehaus.org/content/repositories/snapshots/ Feel free to try it, any feedback is welcome!

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Tom Denley
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: