JDK-8152020 : IAE not thrown if the N argument types at position pos...
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-03-16
  • Updated: 2016-03-22
  • Resolved: 2016-03-22
Related Reports
Relates :  
Description
A test for MHs.foldArguments/3 with this setup (use S for Ljava/lang/String; in signatures): 
* target signature: (SSI)S 
* pos: 0 
* combiner 1 signature: (SI)V 
* combiner 2 signature: (SI)S 

unexpectedly does not throw an exception in the combiner 2 case.

Comments
Thanks!
22-03-2016

Resolved internally; fix will be pushed with JDK-8151179.
22-03-2016

I think the test is wrong in one case. The setup is as follows (use S for Ljava/lang/String; in signatures): * target signature: (SSI)S * pos: 0 * combiner 1 signature: (SI)V * combiner 2 signature: (SI)S According to the API documentation, an IAE should be thrown if (a) if combiner's return type is non-void and not the same as the argument type at position pos of the target signature; (b) if the N argument types at position pos of the target signature (skipping one matching the combiner's return type are not identical with the argument types of combiner. For combiner1: (a) combiner return type is V, case (a) does not apply. (b) N=2, N argument types at position 0 of target signature (skipping 0 because combiner return type is V) = SS, combiner argument types = SI -> throw IAE The test correctly covers this. For combiner2: (a) combiner return type is S, same as return type of target -> OK (b) N=2, N argument types at position 0 of target signature (skipping 1 because combiner return type is S) = SI, combiner argument types = SI -> OK The test wrongly assumes an error. I think the test does not take into account that one argument type is skipped at the given position if the combiner does not return void.
22-03-2016

Yeah, I see now. It's really hard to parse this long sentence. How about splitting it into 2 sentences with explicit clarification about void and same in the second one? I guess this would be helpful since now it looks like "or" just splits two sentences.
22-03-2016