QDox
  1. QDox
  2. QDOX-250

ParseException for one fields with a square bracket initializer and second with a generic type

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.10
    • Fix Version/s: None
    • Component/s: Parser
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      The following code snippet:

      import org.apache.maven.plugin.AbstractMojo;
      import org.apache.maven.plugin.MojoExecutionException;
      import org.apache.maven.plugin.MojoFailureException;
      
      import java.io.File;
      import java.util.Arrays;
      import java.util.HashMap;
      import java.util.List;
      import java.util.Map;
      
      /**
       * @goal mymojo
       */
      public class MyMojo extends AbstractMojo {
      
          // it seems that first field must have an initializer containing square brackets []
          // followed by a field with generic class <> ?
          private List includes = Arrays.asList(new String[]{"abc"});
      
          private Map<String,String> methodContexts = new HashMap<String, String>();
      
          public void execute() throws MojoExecutionException, MojoFailureException {
      
          }
      }
      

      results in a following error:

      com.thoughtworks.qdox.parser.ParseException: syntax error @[22,75] in file:/d:/Work/maven-clover2-plugin-
      a/com/atlassian/maven/plugin/clover/internal/MyMojo.java
              at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:992)
              at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1298)
              at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:973)
              at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:322)
              at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:354)
              at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:350)
              at com.thoughtworks.qdox.JavaDocBuilder$2.visitFile(JavaDocBuilder.java:440)
              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.scan(DirectoryScanner.java:52)
              at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:437)
              at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:426)
              at org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor.discoverClasses(JavaM
      tractor.java:628)
              at org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtractor.execute(JavaMojoDescr
      java:592)
              at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor(DefaultMojoS
      )
              at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:171)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleE
      6)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecy
      a:387)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecut
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
              at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
              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:597)
              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)
      

      I've noticed that these two fields interact with each other somehow. Commenting one of them removes the error. Also changing field order removes the error.

        Activity

        Hide
        Robert Scholte added a comment -

        Seems to be fixed in 1.11.

        To confirm yourself, download the QDox jar from Maven Central and execute

        java -cp qdox-1.11.jar com.thoughtworks.qdox.tools.QDoxTester MyMojo.java

        I've just verified on the trunk of the maven-javadoc-plugin that it's already using QDox 1.12. I can push that to 1.12.1, so those latest bugfixes are included as well.

        Show
        Robert Scholte added a comment - Seems to be fixed in 1.11. To confirm yourself, download the QDox jar from Maven Central and execute java -cp qdox-1.11.jar com.thoughtworks.qdox.tools.QDoxTester MyMojo.java I've just verified on the trunk of the maven-javadoc-plugin that it's already using QDox 1.12. I can push that to 1.12.1, so those latest bugfixes are included as well.
        Robert Scholte made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Robert Scholte [ rfscholte ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Marek Parfianowicz added a comment -

        Indeed, it works. Thanks.

        Show
        Marek Parfianowicz added a comment - Indeed, it works. Thanks.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: