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

Private and protected inner classes have incorrect access modifier values

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.13
    • Fix Version/s: 3.0.0-rc-2
    • Component/s: Compiler
    • Labels:
      None

      Description

      import java.lang.reflect.Modifier           
      class Foo {                                 
          private class Private {}
          protected class Protected {}
      
          static void test() {
              assert Modifier.isPrivate(Private.class.getModifiers()) \\ 0
              assert Modifier.isProtected(Protected.class.getModifiers()) \\ 1
          }            
      }                                           
      Foo.test()
      

      The test above fails (on both assertions). This appears to be due to the ACC_PRIVATE and ACC_PROTECTED modifiers being removed/replaced for inner classes, as well as from their inner class table entries (see GROOVY-6357). Though those modifiers aren't valid for the classes themselves, they are allowed in the inner classes table (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6).

        Attachments

          Activity

            People

            • Assignee:
              shils Shil Sinha
              Reporter:
              shils Shil Sinha

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m

                  Issue deployment