Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8166422

Javac does not allow private interface methods to be declared final

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P4
    • 9
    • None
    • tools
    • None
    • generic
    • generic

    Description

      This program:

      // --
      interface IfaceWithPrivateFinalMethod {
          private final void privateFinalMethod() {}
      }

      triggers the error:

      X.java:2: error: modifier final not allowed here
          private final void privateFinalMethod() {}
                             ^
      1 error

      It would seem since private methods are not inherited, they are final anyway and the compiler should allow the combination of private and final to modify an interface method.

      Attachments

        Issue Links

          Activity

            People

              sadayapalam Srikanth Adayapalam (Inactive)
              sadayapalam Srikanth Adayapalam (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: