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

Account for package-private methods when overriding as protected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.7, 2.5.8, 3.0.0-beta-3
    • 2.5.9, 3.0.0-rc-1
    • None
    • None

    Description

      When overriding a method as `protected` with a super method being package-private (no modifier in Java or `@PackageScope` in Groovy), compilation fails with an error similar to this:

      ...
      exampleMethod(java.lang.Object -> java.lang.Object) in com.example.Child cannot override exampleMethod in com.example.Base; attempting to assign weaker access privileges; was package-private
      ...
      

      This edge case seems to be missed at GROOVY-8651.

      I submitted a pull request at https://github.com/apache/groovy/pull/1038

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              gesellix Tobias Gesellchen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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