RFR: 8174222: LambdaMetafactory: validate inputs and improve documentation

Dan Smith daniel.smith at oracle.com
Thu Mar 21 13:39:05 UTC 2019

> On Mar 20, 2019, at 11:22 PM, Mandy Chung <mandy.chung at oracle.com> wrote:
> On 3/20/19 9:03 PM, Dan Smith wrote:
>> http://cr.openjdk.java.net/~dlsmith/8174222/webrev.00/
> AbstractValidatingLambdaMetafactory.java
> +            throw new LambdaConversionException("implementation is not direct or cannot be cracked");
> It may help to print implementation method handle:
>    throw new LambdaConversionException(implementation + " is not direct or cannot be cracked");

Not sure how useful the toString will be, but I suppose it's better than nothing. They seem to all start with "MethodHandle", so at least it will be clear what kind of object we're talking about. Done.

> If you mind the formatting, the text descripting @param seems 
> to be aligned with the first word in the description above it.
> I don't know if the webrev shows the whitespace properly
> you may want to check out line 90-93.

Yes, those need some extra indenting. Fixed.

> Where does SecurityException get thrown?

The call to 'revealDirect'. Added a comment.

> I think this needs a CSR.  metafactory and altMetafactory @throws 
> IAE, NPE and SecurityException.

Yes, agreed. Created here:

> The class description of LambdaMetafactory also promotes @implNote to the spec.

Yep. Changed to an @apiNote, actually. It was wrong to treat it as an @implNote, because implementations don't get to decide which set of MethodHandles to support.

> Otherwise looks good.


More information about the core-libs-dev mailing list