JDK-8071788 : CountingWrapper.asType() is broken
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 8u60,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-01-28
  • Updated: 2016-05-27
  • Resolved: 2015-01-29
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 8 JDK 9
8u60Fixed 9 b52Fixed
Description
BlockInliningWrapper.asType is broken: wrong LambdaForm is constructed in some cases.

Not possible to provoke the failure in current codebase: BlockInliningWrapper is used only in GWT to wrap target and fallback MethodHandles. It means that MethodHandle.asType() is never called on BlockInliningWrapper. 

ILW = HLL = P4
I = possible crash
L = L = not possible in current code
W = L = no need in a workaround so far; not possible right now
Comments
noreg-hard: needs code shape to reproduce which is impossible in the product right now.
29-01-2015

Proposed fix: diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -832,7 +832,7 @@ MethodHandle wrapper; if (isCounting) { LambdaForm lform; - lform = countingFormProducer.apply(target); + lform = countingFormProducer.apply(newTarget); wrapper = new CountingWrapper(newTarget, lform, countingFormProducer, nonCountingFormProducer, DONT_INLINE_THRESHOLD); } else { wrapper = newTarget; // no need for a counting wrapper anymore
28-01-2015