-
Bug
-
Resolution: Fixed
-
P2
-
hs25, 8
-
TL build of JDK8
-
b18
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8008036 | 8 | Karen Kinnear | P2 | Closed | Fixed | b77 |
Extend an interface with default method, existing code using that interface build with -target 1.5 will cause throwing java.lang.VerifyError with "Illegal use of nonvirtual function call".
Attached is a test case to illustrate the bug.
Build TestInterface.java + MyInterface.java.1.5(rename to MyInterface.java) with
$ cp MyInterface.java.1.5 MyInterface.java
$ javac -source 1.5 -target 1.5 TestInterface.java
$java TestInterface
foo
Now replace MyInterface with new version,
$ cp MyInterface.java.1.8 MyInterface.java
$ javac MyInterace.java
$ java TestInterface
Exception in thread "main" java.lang.VerifyError: (class: TestInterface$1, method: bar signature: ()V) Illegal use of nonvirtual function call
at TestInterface.main(TestInterface.java:3)
Note that build to target 1.6 works as expected.
Attached is a test case to illustrate the bug.
Build TestInterface.java + MyInterface.java.1.5(rename to MyInterface.java) with
$ cp MyInterface.java.1.5 MyInterface.java
$ javac -source 1.5 -target 1.5 TestInterface.java
$java TestInterface
foo
Now replace MyInterface with new version,
$ cp MyInterface.java.1.8 MyInterface.java
$ javac MyInterace.java
$ java TestInterface
Exception in thread "main" java.lang.VerifyError: (class: TestInterface$1, method: bar signature: ()V) Illegal use of nonvirtual function call
at TestInterface.main(TestInterface.java:3)
Note that build to target 1.6 works as expected.
- backported by
-
JDK-8008036 Default method cause java.lang.VerifyError: Illegal use of nonvirtual function call
-
- Closed
-
- blocks
-
JDK-8001667 Comparator combinators and extension methods
-
- Closed
-
-
JDK-8005051 default methods for Iterator
-
- Closed
-
- duplicates
-
JDK-8006291 nightly-tl build can not launch tomcat 5.5 server because of some security class
-
- Closed
-