RFR: JDK-8224158: assertion related to NPE at DynamicCallSiteDesc::withArgs should be reworded
Roger Riggs
Roger.Riggs at oracle.com
Wed May 29 17:05:58 UTC 2019
Hi Vicente,
Why fix just this one method? The other methods of DynamicCallSiteDesc
do not make the
same claim for bootstrapArgs and the code does not check for the
contents being null
nor does the constructor that is invoked that clones the array. (Line 81).
The overhead of a change and CSR is high enough to either save them up
in a single issue
or related issues and handle them all at once or make a pass through the
whole class
and related classes to clean up the spec for null handling.
Frequently, it is sufficient to make a class or package level
declaration such as in java.time.package-info.java
"* Unless otherwise noted, passing a null argument to a constructor or
method in any class or interface * in this package will cause a {@link
java.lang.NullPointerException NullPointerException} to be thrown."
$.02, Roger
On 05/29/2019 10:49 AM, Vicente Romero wrote:
> Please review fix for [1] at [2] and the CSR at [3]. This is a simple
> fix that is just rewording an assertion at method
> java.lang.constant.DynamicCallSiteDesc::withArgs. The fix is simply:
>
> diff -r dd321e3596c0 -r 78f3b29fb255
> src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
> ---
> a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
> Wed May 29 13:58:05 2019 +0100
> +++
> b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
> Wed May 29 09:14:55 2019 -0400
> @@ -156,7 +156,7 @@
> * to the bootstrap, that would appear in the
> * {@code BootstrapMethods} attribute
> * @return the nominal descriptor
> - * @throws NullPointerException if any parameter is null
> + * @throws NullPointerException if its argument or its contents
> are {@code null}
> */
> public DynamicCallSiteDesc withArgs(ConstantDesc... bootstrapArgs) {
> return new DynamicCallSiteDesc(bootstrapMethod,
> invocationName, invocationType, bootstrapArgs);
>
> Thanks,
> Vicente
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8224158
> [2] http://cr.openjdk.java.net/~vromero/8224158/webrev.00/
> [3] https://bugs.openjdk.java.net/browse/JDK-8224985
More information about the core-libs-dev
mailing list