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

NPE in AntlrParserPlugin on incorrect array creation expression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.1, 1.8.9, 2.0.8, 3.0.0-rc-3
    • 3.0.0
    • None

    Description

      Groovy parser fails on incorrect array creation expression:

      $ java -jar groovy-all-1.8.1.jar -d -e "def foo = new double[][5]"
      Caught: BUG! exception in phase 'conversion' in source unit 'script_from_command_line' null
      BUG! exception in phase 'conversion' in source unit 'script_from_command_line' null
              at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:843)
              at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544)
              at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:520)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
              at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
              at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
              at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
              at groovy.lang.GroovyShell.run(GroovyShell.java:516)
              at groovy.lang.GroovyShell.run(GroovyShell.java:172)
              at groovy.ui.GroovyMain.processOnce(GroovyMain.java:526)
              at groovy.ui.GroovyMain.run(GroovyMain.java:332)
              at groovy.ui.GroovyMain.process(GroovyMain.java:318)
              at groovy.ui.GroovyMain.processArgs(GroovyMain.java:115)
              at groovy.ui.GroovyMain.main(GroovyMain.java:96)
      Caused by: java.lang.NullPointerException
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expressionSwitch(AntlrParserPlugin.java:1649)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expression(AntlrParserPlugin.java:1633)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expression(AntlrParserPlugin.java:1629)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.arraySizeExpression(AntlrParserPlugin.java:2509)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.arraySizeExpression(AntlrParserPlugin.java:2507)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.constructorCallExpression(AntlrParserPlugin.java:2460)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expressionSwitch(AntlrParserPlugin.java:1670)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expression(AntlrParserPlugin.java:1633)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.expression(AntlrParserPlugin.java:1629)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.declarationExpression(AntlrParserPlugin.java:1437)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.variableDef(AntlrParserPlugin.java:1453)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.statement(AntlrParserPlugin.java:1203)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.convertGroovy(AntlrParserPlugin.java:304)
              at org.codehaus.groovy.antlr.AntlrParserPlugin.buildAST(AntlrParserPlugin.java:241)
              at org.codehaus.groovy.control.SourceUnit.convert(SourceUnit.java:272)
              at org.codehaus.groovy.control.CompilationUnit$10.call(CompilationUnit.java:618)
              at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839)
              ... 13 more
      
      $ java -jar groovy-all-1.8.1.jar -v
      Groovy Version: 1.8.1 JVM: 1.6.0_25
      

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            edebrev Eugene Debrev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: