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

Empty statement before semicolon with parrot parser

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-1
    • Fix Version/s: 2.6.0-alpha-1
    • Component/s: parser
    • Labels:
      None

      Description

      The folowing snippet:

      for (foo in []) {;
      }
      

      while a little unusual with the semicolon separating two empty statements (or terminating an empty statement if you look at things that way) should be valid but instead gives:

      BUG! exception in phase 'conversion' in source unit 'ConsoleScript12' java.lang.NullPointerException
      ...
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      	at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:227)
      ...
      Caused by: java.lang.NullPointerException
      	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
      ...
      

        Activity

        Hide
        blackdrag Jochen Theodorou added a comment -

        this is getStatements returning null? That should not happen

        Show
        blackdrag Jochen Theodorou added a comment - this is getStatements returning null? That should not happen
        Hide
        paulk Paul King added a comment -
        Show
        paulk Paul King added a comment - Jochen Theodorou Agreed
        Show
        daniel_sun Daniel Sun added a comment - - edited Fixed by https://github.com/apache/groovy/commit/1a1dbd801a09ea56a4d2a80a148fbee8a753d862

          People

          • Assignee:
            daniel_sun Daniel Sun
            Reporter:
            paulk Paul King
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development