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

nested classes on interfaces are not static

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.4.7
    • None
    • class generator
    • None

    Description

      According to the JLS, "A member type declaration in an interface is implicitly static and public", and there does not seem to be any reason for Groovy to support non-static nested classes on interfaces. However, classes not explicitly marked static do not have the static flag set. This appears to be a simple bug in the class generator, as the generated constructor does not attempt to store an outer reference or otherwise behave as an inner class. It does, however, break reflective code (Jackson) that gets very confused when looking for an eligible constructor.

      interface Example {
        class Response {
          int code
        }
      }
      

      Expected result: Example$Response has the static modifier flag set.
      Actual result: It does not.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chrylis Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: