JDK-7052782 : Two langtools regression tests fail due to fix for 7034977 which removed the invokeGeneric method
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2011-06-08
  • Updated: 2012-09-11
  • Resolved: 2011-07-15
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
7 b146Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The affected tests are:
   tools/javac/meth/InvokeMH.java
   tools/javac/meth/XlintWarn.java

These testes get compilation errors such as:
/export/home/aurora/sandbox/testbase/tools/javac/meth/InvokeMH.java:93: error: cannot find symbol
        mh_vi.invokeGeneric();
             ^
  symbol:   method invokeGeneric()
  location: variable mh_vi of type MethodHandle
     :
test result: Failed. Compilation failed: exit code 1
Actually, two CRs were involved in the change that created this issue:
   7034977: JSR 292 MethodHandle.invokeGeneric should be renamed MethodHandle.invoke [deprecated invokeGeneric]
   7032323: code changes for JSR 292 EG adjustments to API, through Public Review [removed the deprecated method]

Comments
EVALUATION The MethodHandle.invokeGeneric method was renamed to MethodHandle.invoke by the JSR 292 EG, but two regression tests that call invokeGeneric were not changed to call invoke instead, so those tests now get compilation errors. There is no bug in javac nor in JSR 292 code. After invokeGeneric is changed to invoke, the two tests pass on Win XP and on Solaris.
08-06-2011

SUGGESTED FIX The fix is to replace 'invokeGeneric' by 'invoke' in these two tests. hg diff test/tools/javac/meth diff -r c455e2ae5c93 test/tools/javac/meth/InvokeMH.java --- a/test/tools/javac/meth/InvokeMH.java Thu Jun 02 13:38:55 2011 -0700 +++ b/test/tools/javac/meth/InvokeMH.java Wed Jun 08 14:18:00 2011 -0700 @@ -77,23 +77,23 @@ Object o; String s; int i; // for return type testing // next five must have sig = (*,*)* - o = mh_SiO.invokeGeneric((Object)"world", (Object)123); - mh_SiO.invokeGeneric((Object)"mundus", (Object)456); + o = mh_SiO.invoke((Object)"world", (Object)123); + mh_SiO.invoke((Object)"mundus", (Object)456); Object k = "kosmos"; - o = mh_SiO.invokeGeneric(k, 789); - o = mh_SiO.invokeGeneric(null, 000); - o = mh_SiO.invokeGeneric("arda", -123); + o = mh_SiO.invoke(k, 789); + o = mh_SiO.invoke(null, 000); + o = mh_SiO.invoke("arda", -123); // sig = ()String - o = mh_vS.invokeGeneric(); + o = mh_vS.invoke(); // sig = ()int - i = (int) mh_vi.invokeGeneric(); - o = (int) mh_vi.invokeGeneric(); - mh_vi.invokeGeneric(); + i = (int) mh_vi.invoke(); + o = (int) mh_vi.invoke(); + mh_vi.invoke(); // sig = ()void - mh_vv.invokeGeneric(); - o = mh_vv.invokeGeneric(); + mh_vv.invoke(); + o = mh_vv.invoke(); } } diff -r c455e2ae5c93 test/tools/javac/meth/XlintWarn.java --- a/test/tools/javac/meth/XlintWarn.java Thu Jun 02 13:38:55 2011 -0700 +++ b/test/tools/javac/meth/XlintWarn.java Wed Jun 08 14:18:00 2011 -0700 @@ -35,19 +35,19 @@ class XlintWarn { void test(MethodHandle mh) throws Throwable { int i1 = (int)mh.invokeExact(); - int i2 = (int)mh.invokeGeneric(); + int i2 = (int)mh.invoke(); int i3 = (int)mh.invokeWithArguments(); } void test2(MethodHandle mh) throws Throwable { int i1 = (int)(mh.invokeExact()); - int i2 = (int)(mh.invokeGeneric()); + int i2 = (int)(mh.invoke()); int i3 = (int)(mh.invokeWithArguments()); } void test3(MethodHandle mh) throws Throwable { int i1 = (int)((mh.invokeExact())); - int i2 = (int)((mh.invokeGeneric())); + int i2 = (int)((mh.invoke())); int i3 = (int)((mh.invokeWithArguments())); } }
08-06-2011