8270025: DynamicCallSiteDesc::withArgs doesn't throw NPE

Reviewed-by: jvernee, mchung
This commit is contained in:
Vicente Romero 2021-07-13 17:48:21 +00:00
parent d32e42cdd4
commit 8583aab374
2 changed files with 197 additions and 2 deletions

View file

@ -66,7 +66,7 @@ public class DynamicCallSiteDesc {
* @param bootstrapArgs {@link ConstantDesc}s describing the static arguments
* to the bootstrap, that would appear in the
* {@code BootstrapMethods} attribute
* @throws NullPointerException if any parameter is null
* @throws NullPointerException if any parameter or its contents are {@code null}
* @throws IllegalArgumentException if the invocation name has the incorrect
* format
* @jvms 4.2.2 Unqualified Names
@ -79,6 +79,9 @@ public class DynamicCallSiteDesc {
this.invocationType = requireNonNull(invocationType);
this.bootstrapMethod = requireNonNull(bootstrapMethod);
this.bootstrapArgs = requireNonNull(bootstrapArgs.clone());
for (int i = 0; i < this.bootstrapArgs.length; i++) {
requireNonNull(this.bootstrapArgs[i]);
}
if (invocationName.length() == 0)
throw new IllegalArgumentException("Illegal invocation name: " + invocationName);
}
@ -97,7 +100,7 @@ public class DynamicCallSiteDesc {
* 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 any parameter or its contents are {@code null}
* @throws IllegalArgumentException if the invocation name has the incorrect
* format
* @jvms 4.2.2 Unqualified Names