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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • hs25
    • hotspot
    • None
    • b03

        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.)

              hseigel Harold Seigel (Inactive)
              hseigel Harold Seigel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: