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

can't call this(string) in constructor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-JSR-1
    • 1.0-JSR-3
    • parser
    • None
    • All

    Description

      // demo.groovy, below file is OK
      class B {
      public B(String s)

      { println s }
      public void communicate(){println "hello"}
      }

      b = new B("SSSS");
      b.communicate();
      //end of demo.groovy

      //another demo.groovy, below file is invalid
      class B {
      public B() {this("default")}
      public B(String s) { println s }

      public void communicate()

      {println "hello"}

      }

      b = new B("SSSS");
      b.communicate();
      //end of demo.groovy

      //below is the exception
      e:\groovy\demo.groovy: -1: PARSER BUG: Tried to configure org.codehaus.groovy.ast.expr.ArgumentListExpression with null Node. File: e:\groovy\demo.groovy @ line -1, column -1.org.codehaus.groovy.antlr.ASTParserException: PARSER BUG: Tried to configure org.codehaus.groovy.ast.expr.ArgumentListExpression with null Node. File: e:\groovy\demo.groovy @ line -1, column -1.
      at org.codehaus.groovy.antlr.AntlrParserPlugin.buildAST(AntlrParserPlugin.java:129)
      at org.codehaus.groovy.control.SourceUnit.convert(SourceUnit.java:315)
      at org.codehaus.groovy.control.CompilationUnit$2.call(CompilationUnit.java:544)
      at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:800)
      at org.codehaus.groovy.control.CompilationUnit.convert(CompilationUnit.java:531)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:460)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:209)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:159)
      at groovy.lang.GroovyShell$1.run(GroovyShell.java:260)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:258)
      at groovy.lang.GroovyShell.run(GroovyShell.java:202)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:416)
      at groovy.ui.GroovyMain.run(GroovyMain.java:249)
      at groovy.ui.GroovyMain.process(GroovyMain.java:235)
      at groovy.ui.GroovyMain.main(GroovyMain.java:138)
      at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:92)
      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:324)
      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:429)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.codehaus.groovy.antlr.ASTRuntimeException: PARSER BUG: Tried to configure org.codehaus.groovy.ast.expr.ArgumentListExpression with null Node
      at org.codehaus.groovy.antlr.AntlrParserPlugin.configureAST(AntlrParserPlugin.java:2015)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.arguments(AntlrParserPlugin.java:1710)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.constructorCallExpression(AntlrParserPlugin.java:1662)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.expressionSwitch(AntlrParserPlugin.java:1017)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.expression(AntlrParserPlugin.java:987)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.statement(AntlrParserPlugin.java:705)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.statementListNoChild(AntlrParserPlugin.java:721)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.statementList(AntlrParserPlugin.java:714)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.constructorDef(AntlrParserPlugin.java:385)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.objectBlock(AntlrParserPlugin.java:306)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.classDef(AntlrParserPlugin.java:288)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.convertGroovy(AntlrParserPlugin.java:150)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.buildAST(AntlrParserPlugin.java:126)
      ... 25 more

      1 Error

      Attachments

        Issue Links

          Activity

            People

              jstrachan James Strachan
              wangbin wangbin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: