-
Bug
-
Resolution: Fixed
-
P3
-
15
-
b26
-
b27
Initially, the method checked all incoming arguments for null:
<<assembled from makeConcatWithConstants && removed doStringConcat>>
public static CallSite makeConcatWithConstants(MethodHandles.Lookup lookup,
String name,
MethodType concatType,
String recipe,
Object... constants)
throws StringConcatException
{
Objects.requireNonNull(lookup, "Lookup is null");
Objects.requireNonNull(name, "Name is null");
Objects.requireNonNull(concatType, "Concat type is null");
Objects.requireNonNull(constants, "Constants are null");
- for (Object o : constants) {
- Objects.requireNonNull(o, "Cannot accept null constants");
- }
....
}
right now the method does not take into account the constants parameter that might be {null}, {1, null} etc. and gets started parsing a recipe. If the recipe contains an error and at least one constant is null then the Method throws StringConcatException although firstly NPE is expected.
If the recipe has no issues then the method throws NPE as expected.
The issue was found by JCK test (JCK-7314262) that used a "wrong" recipe but waited for NPE:
StringConcatFactory.makeConcatWithConstants(lookup(), "name", MethodType.methodType(String.class, String.class, String.class), "", {null});
<<assembled from makeConcatWithConstants && removed doStringConcat>>
public static CallSite makeConcatWithConstants(MethodHandles.Lookup lookup,
String name,
MethodType concatType,
String recipe,
Object... constants)
throws StringConcatException
{
Objects.requireNonNull(lookup, "Lookup is null");
Objects.requireNonNull(name, "Name is null");
Objects.requireNonNull(concatType, "Concat type is null");
Objects.requireNonNull(constants, "Constants are null");
- for (Object o : constants) {
- Objects.requireNonNull(o, "Cannot accept null constants");
- }
....
}
right now the method does not take into account the constants parameter that might be {null}, {1, null} etc. and gets started parsing a recipe. If the recipe contains an error and at least one constant is null then the Method throws StringConcatException although firstly NPE is expected.
If the recipe has no issues then the method throws NPE as expected.
The issue was found by JCK test (JCK-7314262) that used a "wrong" recipe but waited for NPE:
StringConcatFactory.makeConcatWithConstants(lookup(), "name", MethodType.methodType(String.class, String.class, String.class), "", {null});
- relates to
-
JDK-8246152 Improve String concat bootstrapping
-
- Resolved
-