QDox
  1. QDox
  2. QDOX-239

Type.actualArgumentTypes aren't resolved when field declared with wildcard generic

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.12
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Simple test:

      public void testFieldWithWildcardType()
          {
             JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
             StringBuilder b = new StringBuilder("package test;\n");
             b.append("import java.util.ArrayList;\n");
             b.append("import java.util.Map;\n");
             b.append("public class TestClass<E>{\n");
             b.append("public ArrayList<? extends Map<String, E>> list;\n}");
             javaDocBuilder.addSource(new StringReader(b.toString()));
             JavaClass javaClass = javaDocBuilder.getClasses()[0];
             JavaField field = javaClass.getFields()[0];
             assertNotNull(field.getType().getActualTypeArguments()[0].getActualTypeArguments());
             assertEquals("? extends java.util.Map<java.lang.String,E>", field.getType().getActualTypeArguments()[0].getGenericValue());
          }
      

      Seems, type arguments lost in com.thoughtworks.qdox.parser.structs.WildcardTypeDef.
      I add this row

      this.actualArgumentTypes = typeDef.actualArgumentTypes;
      

      to constructor and it's work for me.

        Activity

        Hide
        Robert Scholte added a comment -

        Issue confirmed. QDox-2.0 has faced a huge refactoring, so I had to rewrite the test.
        The suggested fix won't work anymore, but with this test I have enough info to fix the issue.

        Show
        Robert Scholte added a comment - Issue confirmed. QDox-2.0 has faced a huge refactoring, so I had to rewrite the test. The suggested fix won't work anymore, but with this test I have enough info to fix the issue.
        Hide
        Robert Scholte added a comment -

        Fixed in rev. 1491
        I've deployed a 2.0-SNAPSHOT, but be aware that this version is not backwards compatible with QDox-1.x.
        I've already released a first alpha, the second one should come soon once I fixed some migration issues with the gwt-maven-plugin.
        Once we've tested it on enough projects we'll start with beta-releases for all the QDox-users.

        Show
        Robert Scholte added a comment - Fixed in rev. 1491 I've deployed a 2.0-SNAPSHOT, but be aware that this version is not backwards compatible with QDox-1.x. I've already released a first alpha, the second one should come soon once I fixed some migration issues with the gwt-maven-plugin. Once we've tested it on enough projects we'll start with beta-releases for all the QDox-users.
        Robert Scholte made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Robert Scholte [ rfscholte ]
        Fix Version/s 2.0 [ 15636 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Evgen Vidolob
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: