JDK-8151026 : j.l.i.MethodHandles.whileLoop(...) and j.l.i.MethodHandles.doWhileLoop(...) both permit body = null
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-03-02
  • Updated: 2016-03-21
  • Resolved: 2016-03-21
Related Reports
Relates :  
Description
According to specification:

j.l.i.MethodHandles.whileLoop(MH, MH, MH)
body - body of the loop, which may not be null.
j.l.i.MethodHandles.doWhileLoop(MH, MH, MH)
body - body of the loop, which may not be null.

Actually, both methods permit body=null, moreover code from 'implementation notes' sections permits body=null too (no IllegalArgumentException).

Was found on jdk9b107, tests are under development, tck_red will be added after development completion.

Example is attached
Comments
Resolved internally; fix will be pushed with JDK-8151179.
21-03-2016

A null body should be allowed to express an empty loop. The documentation needs to be changed.
21-03-2016