JDK-8152667 : MHs.iteratedLoop(...) throws unexpected WMTE, disallows Iterator subclasses, generates inconsistent loop result type
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-03-24
  • Updated: 2016-04-28
  • Resolved: 2016-04-22
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 9
9 b116Fixed
Related Reports
Relates :  
Description
According to MethodHandles.iteratedLoop(...) documentation, it could throw IllegalArgumentException. Documentation specifies that 'conversion' mistakes could lead to runtime exceptions during loop execution (not creation).


Attached example (IteratedLoop4) produces WrongMethodTypeException.
iterator=null
init=null
body=(String,I,List)I
Was found on jdk9b109, jdk9b110. Tests are under development, tck_red will be added after development completion.


Comments
Reviewing JCK feedback on iteratedLoop() (JDK-8151903), there are the following additional issues: * subclasses of Iterator are not allowed as result types of the iterator handle * loop result type is inconsistently determined (conflict between init and body handles) The fix for this issue will address those as well.
20-04-2016

The bug is due to erroneous handling of the synthetic handle that is created if the iterator handle is null.
19-04-2016