QDox
  1. QDox
  2. QDOX-98

Parser fails on package with annotations

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9
    • Component/s: Parser
    • Labels:
      None
    • Number of attachments :
      1

      Description

      The following file generated by jaxws can not be parsed.

      @javax.xml.bind.annotation.XmlSchema(namespace = "http://docs.oasis-open.org/wsn/br-2")
      package org.oasis_open.docs.wsn.br_2;

        Activity

        Hide
        Paul Hammant added a comment -

        Can you check again please, there has been a release in the last month.

        Show
        Paul Hammant added a comment - Can you check again please, there has been a release in the last month.
        Hide
        Franz Allan Valencia See added a comment -

        What is the status of this issue?

        I tried this with com.thoughtworks.qdox:qdox:1.6.3 but I'm still getting that error.

         
        com.thoughtworks.qdox.parser.ParseException: syntax error @[2,1] in file:/home/franz/sources/com/mycompany/MyClass.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.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)
        
        Show
        Franz Allan Valencia See added a comment - What is the status of this issue? I tried this with com.thoughtworks.qdox:qdox:1.6.3 but I'm still getting that error. com.thoughtworks.qdox.parser.ParseException: syntax error @[2,1] in file:/home/franz/sources/com/mycompany/MyClass.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.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)
        Hide
        Dennis Lundberg added a comment -

        This is still broken in the latest version built from svn.

        Show
        Dennis Lundberg added a comment - This is still broken in the latest version built from svn.
        Hide
        Robert Scholte added a comment -

        I found a solution. This way the parser won't fail anymore. But the annotation is out of reach if we want to stay backwards compatible. The problem is clear: javaSource.getPackage returns a string. To support annotations for a package it has to return some object like JavaPackage.
        So I'm not sure what to do...

        Show
        Robert Scholte added a comment - I found a solution. This way the parser won't fail anymore. But the annotation is out of reach if we want to stay backwards compatible. The problem is clear: javaSource.getPackage returns a string. To support annotations for a package it has to return some object like JavaPackage. So I'm not sure what to do...
        Hide
        Paul Hammant added a comment -

        MATHUS Baptiste wrote:

        > Hi all,
        >
        > I just encountered that very problem: https://svn.cargo.codehaus.org/browse/QDOX-98 when running the paranamer-maven-plugin on a
        > project that dynamically generates a whole package using JAXB.
        >
        > [...]
        >

        If the answer is to change 'String javaSource.getPackage()' to 'JavaPackage javaSource.getPackage()', then that is what we have to do.

        It would be a break of backwards compatibility, but not enough to warrant a jump to QDox 2.x perhaps.

        Show
        Paul Hammant added a comment - MATHUS Baptiste wrote: > Hi all, > > I just encountered that very problem: https://svn.cargo.codehaus.org/browse/QDOX-98 when running the paranamer-maven-plugin on a > project that dynamically generates a whole package using JAXB. > > [...] > If the answer is to change 'String javaSource.getPackage()' to 'JavaPackage javaSource.getPackage()', then that is what we have to do. It would be a break of backwards compatibility, but not enough to warrant a jump to QDox 2.x perhaps.
        Hide
        Baptiste MATHUS added a comment -

        Here's the full stacktrace:

        [INFO] syntax error @[9,1] in file:/C:/tests/cgacore1.2/src/java/fr/mm/cga/moniteur/queue/xml/genere/package-info.java
        [INFO] ------------------------------------------------------------------------
        [INFO] Trace
        com.thoughtworks.qdox.parser.ParseException: syntax error @[9,1] in file:/C:/tests/cgacore1.2/src/java/fr/mm/cga/moniteur/queue/xml/genere/package-info.java
                at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:987)
                at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1293)
                at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:968)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:304)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:324)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:320)
                at com.thoughtworks.qdox.JavaDocBuilder$2.visitFile(JavaDocBuilder.java:400)
                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.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:397)
                at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:386)
                at com.thoughtworks.paranamer.generator.QdoxParanamerGenerator.getClassesSortedByName(QdoxParanamerGenerator.java:66)
                at com.thoughtworks.paranamer.generator.QdoxParanamerGenerator.processSourcePath(QdoxParanamerGenerator.java:60)
                at com.thoughtworks.paranamer.mojo.ParanamerGeneratorMojo.execute(ParanamerGeneratorMojo.java:77)
                at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
                at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
                at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
                at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
                at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
                at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
                at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
                at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

        And the content of the parsed file:

        //
        // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs 
        // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
        // Any modifications to this file will be lost upon recompilation of the source schema. 
        // Generated on: 2009.02.04 at 01:49:27 PM CET 
        //
        
        @javax.xml.bind.annotation.XmlSchema(namespace = "urn://mm:cga:pgih-administratif-1.0:xsd")
        package fr.mm.cga.moniteur.queue.xml.genere;

        Don't hesitate to ask for more informations if necessary.
        HTH.

        Show
        Baptiste MATHUS added a comment - Here's the full stacktrace: [INFO] syntax error @[9,1] in file:/C:/tests/cgacore1.2/src/java/fr/mm/cga/moniteur/queue/xml/genere/ package -info.java [INFO] ------------------------------------------------------------------------ [INFO] Trace com.thoughtworks.qdox.parser.ParseException: syntax error @[9,1] in file:/C:/tests/cgacore1.2/src/java/fr/mm/cga/moniteur/queue/xml/genere/ package -info.java at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:987) at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1293) at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:968) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:304) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:324) at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:320) at com.thoughtworks.qdox.JavaDocBuilder$2.visitFile(JavaDocBuilder.java:400) 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.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:397) at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:386) at com.thoughtworks.paranamer.generator.QdoxParanamerGenerator.getClassesSortedByName(QdoxParanamerGenerator.java:66) at com.thoughtworks.paranamer.generator.QdoxParanamerGenerator.processSourcePath(QdoxParanamerGenerator.java:60) at com.thoughtworks.paranamer.mojo.ParanamerGeneratorMojo.execute(ParanamerGeneratorMojo.java:77) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) And the content of the parsed file: // // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs // See <a href= "http://java.sun.com/xml/jaxb" >http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2009.02.04 at 01:49:27 PM CET // @javax.xml.bind.annotation.XmlSchema(namespace = "urn: //mm:cga:pgih-administratif-1.0:xsd" ) package fr.mm.cga.moniteur.queue.xml.genere; Don't hesitate to ask for more informations if necessary. HTH.
        Hide
        Paul Hammant added a comment -

        > if the answer is to change 'String javaSource.getPackage()' to 'JavaPackage javaSource.getPackage()', then that is what we have to do.

        And we could make JavaPackage implement CharSequence too, as some (poor?) concession to backwards compatibility.

        Show
        Paul Hammant added a comment - > if the answer is to change 'String javaSource.getPackage()' to 'JavaPackage javaSource.getPackage()', then that is what we have to do. And we could make JavaPackage implement CharSequence too, as some (poor?) concession to backwards compatibility.
        Hide
        Robert Scholte added a comment -

        patch ready for review.

        This code can break backwards compatilbility.
        Most important modification to keep the code running:
        getPackage() has be to changed to getPackage().getName()

        Show
        Robert Scholte added a comment - patch ready for review. This code can break backwards compatilbility. Most important modification to keep the code running: getPackage() has be to changed to getPackage().getName()
        Robert Scholte made changes -
        Field Original Value New Value
        Attachment qdox-98.patch [ 40064 ]
        Hide
        Paul Hammant added a comment -

        That was fast work. Looks good to me, commit it Robert

        Show
        Paul Hammant added a comment - That was fast work. Looks good to me, commit it Robert
        Hide
        Robert Scholte added a comment -

        r546 | rfscholte | 2009-02-16 20:09:28 CET

        fix/improvement for qdox-98
        ----------------------------------------------------------------------------

        Show
        Robert Scholte added a comment - r546 | rfscholte | 2009-02-16 20:09:28 CET fix/improvement for qdox-98 ----------------------------------------------------------------------------
        Robert Scholte made changes -
        Resolution Fixed [ 1 ]
        Assignee Robert Scholte [ rfscholte ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.9 [ 14956 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Guillaume Nodet
          • Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: