Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8045203 | 8u25 | Harold Seigel | P4 | Resolved | Fixed | b01 |
JDK-8031635 | 8u20 | Harold Seigel | P4 | Closed | Fixed | b01 |
JDK-8053208 | emb-8u26 | Harold Seigel | P4 | Resolved | Fixed | b17 |
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.)
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.)
- backported by
-
JDK-8045203 The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
- Resolved
-
JDK-8053208 The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
- Resolved
-
JDK-8031635 The JVM should not throw VerifyError when 'overriding' a static final method in a superclass.
- Closed
- relates to
-
JDK-8028549 Ensure consistent treatment of private/static methods during verification
- Closed