mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8068741: javax.script.ScriptEngineFactory.getMethodCallSyntax() spec allows null passed as an object
Reviewed-by: hannesw
This commit is contained in:
parent
f441abcff1
commit
d6cf9ab9cd
3 changed files with 67 additions and 3 deletions
|
@ -76,14 +76,16 @@ public final class NashornScriptEngineFactory implements ScriptEngineFactory {
|
|||
|
||||
@Override
|
||||
public String getMethodCallSyntax(final String obj, final String method, final String... args) {
|
||||
final StringBuilder sb = new StringBuilder().append(obj).append('.').append(method).append('(');
|
||||
final StringBuilder sb = new StringBuilder().
|
||||
append(Objects.requireNonNull(obj)).append('.').
|
||||
append(Objects.requireNonNull(method)).append('(');
|
||||
final int len = args.length;
|
||||
|
||||
if (len > 0) {
|
||||
sb.append(args[0]);
|
||||
sb.append(Objects.requireNonNull(args[0]));
|
||||
}
|
||||
for (int i = 1; i < len; i++) {
|
||||
sb.append(',').append(args[i]);
|
||||
sb.append(',').append(Objects.requireNonNull(args[i]));
|
||||
}
|
||||
sb.append(')');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue