RFR: 8174222: LambdaMetafactory: validate inputs and improve documentation [v2]
liach
github.com+7806504+liach at openjdk.java.net
Fri Jun 4 01:25:58 UTC 2021
On Thu, 3 Jun 2021 20:40:23 GMT, Dan Smith <dlsmith at openjdk.org> wrote:
>> Standardizes and better specifies the errors thrown by LambdaMetafactory, including for inputs that would not be generated by javac.
>>
>> Does some renaming of core parameters/fields to better reflect their purpose.
>>
>> In the implementation, stops using ACC_BRIDGE for any methods, which is not a good fit for what these methods do (they don't delegate to each other, but all invoke the same implementation method).
>
> Dan Smith has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix accidentally commented-out parts of test
src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java line 547:
> 545: throw new IllegalArgumentException("argument has wrong type");
> 546: }
> 547: return type.cast(result);
Can we just use a `return (T) result` as there will always be a checked cast on the caller's end, and this call seems redundant? The only shortcoming is that the call will raise an unchecked warning that needs to be suppressed. Or is this negligible after hotspot optimization?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4346
More information about the core-libs-dev
mailing list