JDK-8161127 : MethodHanlde.loops(...) concerns
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-07-11
  • Updated: 2016-08-04
  • Resolved: 2016-08-04
Description
1. According to doc:
If at least one init function is given,
...
The longest parameter list (which is necessarily unique) is called the "common suffix".


Actually 'init' with same parameter lists are permitted, see attached example Loop0.java.

2. Setp2.d declares 'effectively identical to...' although 
'The term "effectively identical", applied to parameter type lists, means that they must be identical, or else one list must be a proper prefix of the other.'

The definition looks like symmetrical relation (because there is no difference in 'one' and 'another'). Step2.d uses 'effectively identical' in different (directional) way.

See attached example Loop1.java:
E.g. 
init ()I
step (I)I

Common parameter sequence: 'I'
pred (I, I, I)Z and fini (I, I, I)I
both have effectively identical with 'I' lists.
Comments
This is fixed internally; the fix will be contained in the push for JDK-8151179.
04-08-2016

Regarding point 1: the documentation does not imply that each init handle must have a distinct parameter list. It does state that the longest parameter list is necessarily unique - but it can still be shared by multiple init handles. Regarding point 2: will adding the following text to the definition of "effectively identical" help? If the formulation "A must be effectively identical to B" is used, this implies that A and B must be identical, or A must be a proper prefix of B.
04-08-2016

Point 1: Yes, you're right. Now I see the difference. As to point 2 it will be helpful.
29-07-2016