• Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:


      1. There is no information about different argument constratins (iteratior, init, body). Actually, some information could be deduced using pseudocode, but it looks like it would be better to describe it in words. That's because 'init' and 'iterator' accepts 'A' params (by pseudocode), but I assume they could have different, but 'effectively equivalent' params (removing parameter from example's newArrayList changes nothing). Anyway, list of questions not covered in 'words' could be found below:

      Constraints for 'init' argument list:
      -- Should argument list be the same for 'init' and 'iterator' (or be 'effectively equals')?
      -- Which parameter list we should expect as a result of loop creation? Should it be the same as 'init' parameters list or not? What kind of parameter list should we expect in cases:
      ---- 'init'=null
      ---- 'iterator'=null
      ---- 'init'=null && 'iterator'=null?
      It looks like JDK-8150964.
      -- 'body' return type could be deduced using pseudocode, but it would be good to specify it in doc as long as other functions types.

      2. 'Implementation requirements' code will fail with NPE for iterator=null and body=null. This is not equivalent to MethodHandles.iteratedLoop(...) call.

      3. body - the body of the loop, which must not be null. It must accept an initial T parameter (for the iterated values), and then any additional loop-local variable plus loop parameters.

      There is no 'definition' of 'local loop variables', although it could be deduced from
      >> The result of the loop execution is the final value of the additional local state obtained by running init.

      I suppose it would be good to mention what is 'loop-local variables' in clearer way.


        1. IteratedLoop1.java
          2 kB
        2. IteratedLoop10.java
          2 kB
        3. IteratedLoop12.java
          2 kB
        4. IteratedLoop13.java
          2 kB
        5. IteratedLoop15.java
          2 kB
        6. IteratedLoop16.java
          2 kB
        7. IteratedLoop2.java
          2 kB
        8. IteratedLoop6.java
          1 kB
        9. IteratedLoop7.java
          2 kB
        10. IteratedLoop8.java
          2 kB
        11. IteratedLoop9.java
          2 kB

          Issue Links



              mhaupt Michael Haupt
              asolodkaya Anastasiya Solodkaya (Inactive)
              0 Vote for this issue
              2 Start watching this issue