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

The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: hs25
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b03

      Backports

        Description

        Text from Alex:

        HotSpot gives a VerifyError when overriding a static final method in a superclass, but JLS7 13.4.17 implies it should be legal to present the following classes to the JVM: (assume the same package)

        class Sup { static final void m() }
        class Sub extends Sup { void m() }

        As Sup#m is a static method, it logically cannot be overridden. (The fact that it's final and thus "must not be overridden" is short-circuited.) Sub is therefore doing nothing wrong, and no VerifyError is due. (One can argue that this class hierarchy is a long way from legal in the Java language, and deserves a VerifyError, but it is wholly consistent for the verifier to think about final method overriding solely in terms of _instance_ methods in both superclass and subclass.)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hseigel Harold Seigel
                Reporter:
                hseigel Harold Seigel
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: