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

Interface containing field without initialization expression incorrectly compiles

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.7-beta-2
    • None
    • None
    • None

    Description

      For me, this INCORRECTLY compiles:

      interface I {
        String s
      }
      

      Execution in 1.7beta2 groovyconsole gives:

      groovy> interface I {
      groovy>   String s
      groovy> }
      groovy> println I.s
      
      null 
      

      I smell a bug...

      For Java, the rule is: "Every field in the body of an interface must have an initialization expression,..."
      (http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html)

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              alpheratz alpheratz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: