JDK-7194612 : api/java_lang/invoke/MethodHandles/Lookup/index.html#ExceptionsTests[findVirtualNSME] fails w/ -esa
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-08-28
  • Updated: 2014-02-10
  • Resolved: 2012-08-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b53Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
The following JCK8-b12 testcase:
  api/java_lang/invoke/MethodHandles/Lookup/index.html#ExceptionsTests[findVirtualNSME]
fails under JDK8-b52 when '-esa' option is specified:
--- cut ---
Expected exception java.lang.NoSuchMethodException was not thrown by testcase "findVirtualNSME"
"java.lang.AssertionError" was thrown instead
java.lang.AssertionError
	at java.lang.invoke.MemberName.referenceKindIsConsistent(MemberName.java:233)
	at java.lang.invoke.MemberName.setFlags(MemberName.java:312)
	at java.lang.invoke.MemberName.init(MemberName.java:455)
	at java.lang.invoke.MemberName.<init>(MemberName.java:635)
	at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1031)
	at java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:652)
	at javasoft.sqe.tests.api.java.lang.invoke.MethodHandles.Lookup.ExceptionsTests.findVirtualNSME(ExceptionsTests.java:564)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:474)
	at com.sun.tck.lib.tgf.Util.invokeMethod(Util.java:352)
	at com.sun.tck.lib.tgf.Runner.invokeTestCase(Runner.java:276)
	at com.sun.tck.lib.tgf.Runner.performRunWithData(Runner.java:246)
	at com.sun.tck.lib.tgf.Runner.getDataAndRun(Runner.java:185)
	at com.sun.tck.lib.tgf.Runner.executeTestMethods(Runner.java:130)
	at com.sun.tck.lib.tgf.Runner.run(Runner.java:116)
	at com.sun.tck.lib.tgf.Runner.execute(Runner.java:108)
	at com.sun.tck.lib.tgf.TGFTest.run(TGFTest.java:58)
	at com.sun.tck.lib.tgf.TGFTest.run(TGFTest.java:64)
	at javasoft.sqe.tests.api.java.lang.invoke.MethodHandles.Lookup.ExceptionsTests.main(ExceptionsTests.java:59)
Testcase "findVirtualNSME" failed with arguments [class javasoft.sqe.tests.api.java.lang.invoke.MethodHandles.Lookup.TestCls, <init>, ()int]
--- cut ---

The failure is not reproducible without '-esa' option.

Comments
This fix already in promotion build. Verified with jdk8/b125 promotion build by jck tests api/java_lang/invoke/MethodHandles/Lookup/index_ExceptionsTests in description.
23-01-2014

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/a43f1cd05776
28-08-2012

SUGGESTED FIX diff --git a/src/share/classes/java/lang/invoke/MemberName.java b/src/share/classes/java/lang/invoke/MemberName.java --- a/src/share/classes/java/lang/invoke/MemberName.java +++ b/src/share/classes/java/lang/invoke/MemberName.java @@ -306,12 +306,6 @@ return this; } - private void setFlags(int flags) { - this.flags = flags; - assert(testAnyFlags(ALL_KINDS)); - assert(referenceKindIsConsistent()); - } - private boolean testFlags(int mask, int value) { return (flags & mask) == value; } @@ -452,8 +446,10 @@ this.clazz = defClass; this.name = name; this.type = type; - setFlags(flags); + this.flags = flags; + assert(testAnyFlags(ALL_KINDS)); assert(this.resolution == null); // nobody should have touched this yet + //assert(referenceKindIsConsistent()); // do this after resolution } private void expandFromVM() {
28-08-2012

EVALUATION The assert checks for a valid reference kind before method resolution throws the expected NoSuchMethodException.
28-08-2012