Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3101

AntlrParserPlugin is giving error while parsing a java source file that passes array to a last a method's last parameter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.6-beta-1
    • None
    • parser-antlr2
    • None
    • Win XP
      JDK: 1.50_13
      Ant version: 1.6.5

    Description

      I am trying to scan through my source using Antbuilder and parse the files to check if any annotations are present. I came across the following error while parsing a similar kind of file.

      Please find the attached source to reproduce the error. Extract the zip to a folder and copy 1.6-beta-1 jar to that folder and type ant in that folder.

      Error:

      test-groovy:
      [groovy] S:\lms_fiji\dist\groovy\Test.java
      [groovy] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, S:\lms_fiji\dist\groovy\Test.java: 8: unexpected token: a @ line 8, column 29.
      [groovy] Object[] obs = new Object[]

      {a,b};
      [groovy] ^

      [groovy] 1 error

      [groovy] at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
      [groovy] at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:143)
      [groovy] at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:113)
      [groovy] at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:125)
      [groovy] at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:352)
      [groovy] at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:85)
      [groovy] at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:248)
      [groovy] at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:138)
      [groovy] at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:770)
      [groovy] at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:435)
      [groovy] at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:277)
      [groovy] at groovy.lang.GroovyClassLoader$InnerLoader.parseClass(GroovyClassLoader.java:379)
      [groovy] at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:248)
      [groovy] at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:188)
      [groovy] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [groovy] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [groovy] at java.lang.reflect.Method.invoke(Method.java:585)
      [groovy] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:182)
      [groovy] at org.codehaus.groovy.runtime.callsite.CallSite.call(CallSite.java:126)
      [groovy] at Test.run(Test.groovy:35)
      [groovy] at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:350)
      [groovy] at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:230)
      [groovy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      [groovy] at org.apache.tools.ant.Task.perform(Task.java:364)
      [groovy] at org.apache.tools.ant.Target.execute(Target.java:341)
      [groovy] at org.apache.tools.ant.Target.performTasks(Target.java:369)
      [groovy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      [groovy] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      [groovy] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      [groovy] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      [groovy] at org.apache.tools.ant.Main.runBuild(Main.java:668)
      [groovy] at org.apache.tools.ant.Main.startAnt(Main.java:187)
      [groovy] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
      [groovy] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

      BUILD FAILED
      S:\lms_fiji\dist\groovy\build.xml:17: java.lang.RuntimeException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, S:\lms_fiji\dist\groovy\Test.java: 8: unexpected token
      : a @ line 8, column 29.
      Object[] obs = new Object[]{a,b}

      ;
      ^

      1 error

      Attachments

        1. groovy-bug.zip
          1 kB
          Naresh Narayana

        Activity

          People

            blackdrag Jochen Theodorou
            nvnaresh Naresh Narayana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: