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

what does a static outer class declaration mean?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.5
    • 1.8-beta-4
    • None
    • None

    Description

      I'm not sure what is supposed to happen here - you might just need to clarify what it means and close it....

      If I write this

      static class C {
      }
      

      groovyc will compile it. It will produce (as far as I can tell) a classfile identical to:

      class C {
      }
      

      Does static have some special meaning? Maybe it should be getting policed? I imagine static has only been supported in that position since inner type support was added. Doing the same thing in Java shows:

      C.java:1: modifier static not allowed here
      static class C {
             ^
      1 error
      

      I could imagine static might have forced singleton behaviour in some way but it doesn't - the generated class still has a constructor, I can write my own constructor, etc.

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            aclement Andy Clement
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: