QDox
  1. QDox
  2. QDOX-86

inner classes not resolved correctly when appears as method param

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.8
    • Component/s: Java API
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Hi

      QDox (1.6 snapshot + 1.4 + 1.5) reports a wrong parameter type in such a case:

      package some.pack;
      class Test {

      void some(Inner.Inner2 a) {}

      static interface Inner {
      static interface Inner2 { }
      }
      }

      In such a case the argument of method "some" is reported to be of type
      "Inner.Inner2" ie the package information is simply lost.

      method.parameters[0].type.getJavaClass().getFullyQualifiedName()
      ---> Inner.Inner2 instead of some.pack.Test$Inner$Inner2

      ---------
      Joe said: "Looks like a bug in ModelBuilder. Could you raise a Jira issue."

        Activity

        Hide
        Martin Zeltner added a comment -

        Hello,

        I'm using Commons Attributes cvs head and this is using QDox. Now I have exactly this problem and I'd like to fix it but I can't check out QDox from cvs correctly because on one package there is a lock:

        cvs server: Updating java/com/thoughtworks/qdox/model/util
        cvs server: failed to create lock directory for `/home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/util' (/home/projects/qdox/haus.d/lock/cvs/qdox/src/java/com/thoughtworks/qdox/model/util/#cvs.lock): Permission denied
        cvs server: failed to obtain dir lock in repository `/home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/util'
        cvs [server aborted]: read lock failed - giving up

        Is someone fixing this problem at the moment?
        How can I help to fix this?

        Cheers,
        Martin

        Show
        Martin Zeltner added a comment - Hello, I'm using Commons Attributes cvs head and this is using QDox. Now I have exactly this problem and I'd like to fix it but I can't check out QDox from cvs correctly because on one package there is a lock: cvs server: Updating java/com/thoughtworks/qdox/model/util cvs server: failed to create lock directory for `/home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/util' (/home/projects/qdox/haus.d/lock/cvs/qdox/src/java/com/thoughtworks/qdox/model/util/#cvs.lock): Permission denied cvs server: failed to obtain dir lock in repository `/home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/util' cvs [server aborted] : read lock failed - giving up Is someone fixing this problem at the moment? How can I help to fix this? Cheers, Martin
        Hide
        Mike Williams added a comment -

        Hi Martin.

        I'm having no problems updating, and can find no sign of the lock-file mentioned, so I think your CVS problem was a transient one.

        As far as I know no-one is currently working on this issue. Feel free to submit a patch!

        Show
        Mike Williams added a comment - Hi Martin. I'm having no problems updating, and can find no sign of the lock-file mentioned, so I think your CVS problem was a transient one. As far as I know no-one is currently working on this issue. Feel free to submit a patch!
        Hide
        Martin Zeltner added a comment -

        Hi Mike,

        I still can't do a full checkout! I have no permission to read package "com.thoughtworks.qdox.model.util". I login with user "anonymous". I've tried also on another computer with the same result.

        Cheers,
        Martin

        Show
        Martin Zeltner added a comment - Hi Mike, I still can't do a full checkout! I have no permission to read package "com.thoughtworks.qdox.model.util". I login with user "anonymous". I've tried also on another computer with the same result. Cheers, Martin
        Hide
        Mauro Talevi added a comment -

        Changed fix version to 1.7

        Show
        Mauro Talevi added a comment - Changed fix version to 1.7
        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 1.7 [ 11160 ]
        Fix Version/s 1.6 [ 10814 ]
        Hide
        Daniel Lindner added a comment -

        I can confirm this error with an inner Enum class used as method parameter.
        The resulting exception is:

        Exception in thread "main" com.thoughtworks.qdox.parser.ParseException: syntax error @[193,55] in file:/E:/ewi/dev/abas-internal/source/tools/update/Patchmaker/src/main/java/de/abas/eb/patchmaker/process/AbstractArchiveCreationProcess.java
        at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:716)
        at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:826)
        at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:697)
        at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:300)
        at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:316)
        at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:312)
        at com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:369)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
        at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52)
        at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:366)
        at de.abas.eb.xcode.Main.main(Main.java:19)

        When i convert the inner enum to a self-standing java class file, everything works fine.

        Show
        Daniel Lindner added a comment - I can confirm this error with an inner Enum class used as method parameter. The resulting exception is: Exception in thread "main" com.thoughtworks.qdox.parser.ParseException: syntax error @ [193,55] in file:/E:/ewi/dev/abas-internal/source/tools/update/Patchmaker/src/main/java/de/abas/eb/patchmaker/process/AbstractArchiveCreationProcess.java at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:716) at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:826) at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:697) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:300) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:316) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:312) at com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:369) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34) at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52) at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:366) at de.abas.eb.xcode.Main.main(Main.java:19) When i convert the inner enum to a self-standing java class file, everything works fine.
        Hide
        Petr Kozelka added a comment -

        This bug propagates to Maven, with the impact that one cannot create a maven-plugin module containing a class with inner classes.
        In my case, I had to move this (and more) code away to separate utility module:

            ...
            public static final EntryTransformer DROP_ENTRY = new EntryTransformer() {
                public void transform(InputStream is, OutputStream os) {
                    throw new UnsupportedOperationException();
                }
        
                public ZipEntry transformZipEntry(ZipEntry inputZipEntry) {
                    return null;
                }
        
                @Override
                public String toString() {
                    return "DROP";
                }
            };
           ...
        
        Show
        Petr Kozelka added a comment - This bug propagates to Maven, with the impact that one cannot create a maven-plugin module containing a class with inner classes. In my case, I had to move this (and more) code away to separate utility module: ... public static final EntryTransformer DROP_ENTRY = new EntryTransformer() { public void transform(InputStream is, OutputStream os) { throw new UnsupportedOperationException(); } public ZipEntry transformZipEntry(ZipEntry inputZipEntry) { return null; } @Override public String toString() { return "DROP"; } }; ...
        Paul Hammant made changes -
        Fix Version/s 1.8 [ 14826 ]
        Fix Version/s 1.7 [ 11160 ]
        Hide
        Robert Scholte added a comment -

        problem located and resolved. patch includes an improved JavaClass.getNestedClassByName(String name), which only supported a single level nested class. This method is now also used in Type.getJavaClass()
        A test is included based on the example in this issue

        Show
        Robert Scholte added a comment - problem located and resolved. patch includes an improved JavaClass.getNestedClassByName(String name), which only supported a single level nested class. This method is now also used in Type.getJavaClass() A test is included based on the example in this issue
        Robert Scholte made changes -
        Attachment qdox-86.patch [ 39533 ]
        Hide
        Paul Hammant added a comment -

        patch applied.

        Show
        Paul Hammant added a comment - patch applied.
        Paul Hammant made changes -
        Assignee Robert Scholte [ rfscholte ]
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Alexandre Vasseur
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: