mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8147591: Revisit Collection.toArray(new T[size]) calls in nashorn and dynalink code
Reviewed-by: hannesw, mhaupt, sundar
This commit is contained in:
parent
a6932e5352
commit
f651deea03
24 changed files with 59 additions and 59 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -209,8 +209,8 @@ final class TypeConverterFactory {
|
||||||
c.add((ConversionComparator)factory);
|
c.add((ConversionComparator)factory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.factories = l.toArray(new GuardingTypeConverterFactory[l.size()]);
|
this.factories = l.toArray(new GuardingTypeConverterFactory[0]);
|
||||||
this.comparators = c.toArray(new ConversionComparator[c.size()]);
|
this.comparators = c.toArray(new ConversionComparator[0]);
|
||||||
this.autoConversionStrategy = autoConversionStrategy;
|
this.autoConversionStrategy = autoConversionStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ final class TypeConverterFactory {
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
final MethodHandle newHandle =
|
final MethodHandle newHandle =
|
||||||
MethodHandles.filterArguments(handle, pos, converters.toArray(new MethodHandle[converters.size()]));
|
MethodHandles.filterArguments(handle, pos, converters.toArray(new MethodHandle[0]));
|
||||||
converters.clear();
|
converters.clear();
|
||||||
return newHandle;
|
return newHandle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -133,7 +133,7 @@ class AccessibleMembersLookup {
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<?>[] getInnerClasses() {
|
Class<?>[] getInnerClasses() {
|
||||||
return innerClasses.toArray(new Class<?>[innerClasses.size()]);
|
return innerClasses.toArray(new Class<?>[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -112,7 +112,7 @@ public class CompositeGuardingDynamicLinker implements GuardingDynamicLinker {
|
||||||
for(final GuardingDynamicLinker linker: linkers) {
|
for(final GuardingDynamicLinker linker: linkers) {
|
||||||
l.add(Objects.requireNonNull(linker));
|
l.add(Objects.requireNonNull(linker));
|
||||||
}
|
}
|
||||||
this.linkers = l.toArray(new GuardingDynamicLinker[l.size()]);
|
this.linkers = l.toArray(new GuardingDynamicLinker[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -157,7 +157,7 @@ public class CompositeTypeBasedGuardingDynamicLinker implements TypeBasedGuardin
|
||||||
for(final TypeBasedGuardingDynamicLinker linker: linkers) {
|
for(final TypeBasedGuardingDynamicLinker linker: linkers) {
|
||||||
l.add(Objects.requireNonNull(linker));
|
l.add(Objects.requireNonNull(linker));
|
||||||
}
|
}
|
||||||
this.classToLinker = new ClassToLinker(l.toArray(new TypeBasedGuardingDynamicLinker[l.size()]));
|
this.classToLinker = new ClassToLinker(l.toArray(new TypeBasedGuardingDynamicLinker[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -209,7 +209,7 @@ public class ChainedCallSite extends AbstractRelinkableCallSite {
|
||||||
invocations = newInvocations.getFirst();
|
invocations = newInvocations.getFirst();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
invocations = newInvocations.toArray(new GuardedInvocation[newInvocations.size()]);
|
invocations = newInvocations.toArray(new GuardedInvocation[0]);
|
||||||
}
|
}
|
||||||
setTarget(target);
|
setTarget(target);
|
||||||
return target;
|
return target;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -182,7 +182,7 @@ public abstract class NashornException extends RuntimeException {
|
||||||
st.getFileName(), st.getLineNumber()));
|
st.getFileName(), st.getLineNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filtered.toArray(new StackTraceElement[filtered.size()]);
|
return filtered.toArray(new StackTraceElement[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2996,8 +2996,8 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
|
||||||
|
|
||||||
// Copy values and labels to arrays.
|
// Copy values and labels to arrays.
|
||||||
final int size = tree.size();
|
final int size = tree.size();
|
||||||
final Integer[] values = tree.keySet().toArray(new Integer[size]);
|
final Integer[] values = tree.keySet().toArray(new Integer[0]);
|
||||||
final Label[] labels = tree.values().toArray(new Label[size]);
|
final Label[] labels = tree.values().toArray(new Label[0]);
|
||||||
|
|
||||||
// Discern low, high and range.
|
// Discern low, high and range.
|
||||||
final int lo = values[0];
|
final int lo = values[0];
|
||||||
|
@ -5203,7 +5203,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return names.toArray(new String[names.size()]);
|
return names.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String commonPrefix(final String s1, final String s2) {
|
private static String commonPrefix(final String s1, final String s2) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -141,7 +141,7 @@ public final class FunctionSignature {
|
||||||
paramTypeList.add(paramType.getTypeClass());
|
paramTypeList.add(paramType.getTypeClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.methodType = MH.type(returnType.getTypeClass(), paramTypeList.toArray(new Class<?>[paramTypes.length]));
|
this.methodType = MH.type(returnType.getTypeClass(), paramTypeList.toArray(new Class<?>[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -136,7 +136,7 @@ public class Block extends Node implements BreakableNode, Terminal, Flags<Block>
|
||||||
* @param statements All statements in the block
|
* @param statements All statements in the block
|
||||||
*/
|
*/
|
||||||
public Block(final long token, final int finish, final int flags, final List<Statement> statements) {
|
public Block(final long token, final int finish, final int flags, final List<Statement> statements) {
|
||||||
this(token, finish, flags, statements.toArray(new Statement[statements.size()]));
|
this(token, finish, flags, statements.toArray(new Statement[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block(final Block block, final int finish, final List<Statement> statements, final int flags, final Map<String, Symbol> symbols, final LocalVariableConversion conversion) {
|
private Block(final Block block, final int finish, final List<Statement> statements, final int flags, final Map<String, Symbol> symbols, final LocalVariableConversion conversion) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -250,7 +250,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Expression[] valueToArray(final List<Expression> value) {
|
private static Expression[] valueToArray(final List<Expression> value) {
|
||||||
return value.toArray(new Expression[value.size()]);
|
return value.toArray(new Expression[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -941,7 +941,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayLiteralNode setValue(final LexicalContext lc, final List<Expression> value) {
|
private ArrayLiteralNode setValue(final LexicalContext lc, final List<Expression> value) {
|
||||||
return setValue(lc, value.toArray(new Expression[value.size()]));
|
return setValue(lc, value.toArray(new Expression[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -98,7 +98,7 @@ public final class ASTWriter {
|
||||||
public Node[] toArray() {
|
public Node[] toArray() {
|
||||||
final List<Node> preorder = new ArrayList<>();
|
final List<Node> preorder = new ArrayList<>();
|
||||||
printAST(new StringBuilder(), preorder, null, "root", root, 0);
|
printAST(new StringBuilder(), preorder, null, "root", root, 0);
|
||||||
return preorder.toArray(new Node[preorder.size()]);
|
return preorder.toArray(new Node[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -328,7 +328,7 @@ public final class ObjectSizeCalculator {
|
||||||
this.fieldsSize = newFieldsSize;
|
this.fieldsSize = newFieldsSize;
|
||||||
this.objectSize = roundTo(objectHeaderSize + newFieldsSize, objectPadding);
|
this.objectSize = roundTo(objectHeaderSize + newFieldsSize, objectPadding);
|
||||||
this.referenceFields = newReferenceFields.toArray(
|
this.referenceFields = newReferenceFields.toArray(
|
||||||
new Field[newReferenceFields.size()]);
|
new Field[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(final Object obj, final ObjectSizeCalculator calc) {
|
void visit(final Object obj, final ObjectSizeCalculator calc) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1264,7 +1264,7 @@ public final class NativeArray extends ScriptObject implements OptimisticBuiltin
|
||||||
// behaviour of sort is implementation-defined.
|
// behaviour of sort is implementation-defined.
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.toArray(new Object[array.length]);
|
return list.toArray(new Object[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -379,7 +379,7 @@ public final class NativeDebug extends ScriptObject {
|
||||||
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
|
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
|
||||||
public static Object getRuntimeEvents(final Object self) {
|
public static Object getRuntimeEvents(final Object self) {
|
||||||
final LinkedList<RuntimeEvent<?>> q = getEventQueue(self);
|
final LinkedList<RuntimeEvent<?>> q = getEventQueue(self);
|
||||||
return q.toArray(new RuntimeEvent<?>[q.size()]);
|
return q.toArray(new RuntimeEvent<?>[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -130,7 +130,7 @@ public final class NativeFunction {
|
||||||
return (Object[])array;
|
return (Object[])array;
|
||||||
} else if (array instanceof List) {
|
} else if (array instanceof List) {
|
||||||
final List<?> list = (List<?>)array;
|
final List<?> list = (List<?>)array;
|
||||||
return list.toArray(new Object[list.size()]);
|
return list.toArray(new Object[0]);
|
||||||
} else if (array == null || array == UNDEFINED) {
|
} else if (array == null || array == UNDEFINED) {
|
||||||
return ScriptRuntime.EMPTY_ARRAY;
|
return ScriptRuntime.EMPTY_ARRAY;
|
||||||
} else if (array instanceof JSObject) {
|
} else if (array instanceof JSObject) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -702,7 +702,7 @@ public final class NativeObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!propList.isEmpty()) {
|
if (!propList.isEmpty()) {
|
||||||
targetObj.addBoundProperties(sourceObj, propList.toArray(new Property[propList.size()]));
|
targetObj.addBoundProperties(sourceObj, propList.toArray(new Property[0]));
|
||||||
}
|
}
|
||||||
} else if (source instanceof ScriptObjectMirror) {
|
} else if (source instanceof ScriptObjectMirror) {
|
||||||
// get enumerable, immediate properties of mirror
|
// get enumerable, immediate properties of mirror
|
||||||
|
@ -819,7 +819,7 @@ public final class NativeObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetObj.addBoundProperties(source, properties.toArray(new AccessorProperty[properties.size()]));
|
targetObj.addBoundProperties(source, properties.toArray(new AccessorProperty[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MethodHandle getBoundBeanMethodGetter(final Object source, final MethodHandle methodGetter) {
|
private static MethodHandle getBoundBeanMethodGetter(final Object source, final MethodHandle methodGetter) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -377,7 +377,7 @@ public class PropertyMap implements Iterable<Object>, Serializable {
|
||||||
if (Context.DEBUG) {
|
if (Context.DEBUG) {
|
||||||
protoInvalidations.add(size);
|
protoInvalidations.add(size);
|
||||||
}
|
}
|
||||||
SwitchPoint.invalidateAll(protoSwitches.values().toArray(new SwitchPoint[size]));
|
SwitchPoint.invalidateAll(protoSwitches.values().toArray(new SwitchPoint[0]));
|
||||||
protoSwitches.clear();
|
protoSwitches.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -993,7 +993,7 @@ public class ScriptFunction extends ScriptObject {
|
||||||
if (bestInvoker.getSwitchPoints() != null) {
|
if (bestInvoker.getSwitchPoints() != null) {
|
||||||
sps.addAll(Arrays.asList(bestInvoker.getSwitchPoints()));
|
sps.addAll(Arrays.asList(bestInvoker.getSwitchPoints()));
|
||||||
}
|
}
|
||||||
final SwitchPoint[] spsArray = sps.isEmpty() ? null : sps.toArray(new SwitchPoint[sps.size()]);
|
final SwitchPoint[] spsArray = sps.isEmpty() ? null : sps.toArray(new SwitchPoint[0]);
|
||||||
|
|
||||||
return new GuardedInvocation(
|
return new GuardedInvocation(
|
||||||
boundHandle,
|
boundHandle,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1334,7 +1334,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||||
for (ScriptObject self = this; self != null; self = self.getProto()) {
|
for (ScriptObject self = this; self != null; self = self.getProto()) {
|
||||||
keys.addAll(Arrays.asList(self.getOwnKeys(String.class, true, nonEnumerable)));
|
keys.addAll(Arrays.asList(self.getOwnKeys(String.class, true, nonEnumerable)));
|
||||||
}
|
}
|
||||||
return keys.toArray(new String[keys.size()]);
|
return keys.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2146,7 +2146,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
switchPoints.add(getMap().getSwitchPoint(name));
|
switchPoints.add(getMap().getSwitchPoint(name));
|
||||||
return switchPoints.toArray(new SwitchPoint[switchPoints.size()]);
|
return switchPoints.toArray(new SwitchPoint[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSharedProtoMap() {
|
private void checkSharedProtoMap() {
|
||||||
|
@ -2505,7 +2505,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||||
for (ScriptObject self = object; self != null; self = self.getProto()) {
|
for (ScriptObject self = object; self != null; self = self.getProto()) {
|
||||||
keys.addAll(Arrays.asList(self.getOwnKeys(String.class, false, nonEnumerable)));
|
keys.addAll(Arrays.asList(self.getOwnKeys(String.class, false, nonEnumerable)));
|
||||||
}
|
}
|
||||||
this.values = keys.toArray(new String[keys.size()]);
|
this.values = keys.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2523,7 +2523,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||||
valueList.add(self.get(key));
|
valueList.add(self.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.values = valueList.toArray(new Object[valueList.size()]);
|
this.values = valueList.toArray(new Object[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -176,7 +176,7 @@ public final class Timing implements Loggable {
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return strs.toArray(new String[strs.size()]);
|
return strs.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -166,7 +166,7 @@ public class ParallelTestRunner {
|
||||||
final List<String> args = getCompilerArgs();
|
final List<String> args = getCompilerArgs();
|
||||||
int errors;
|
int errors;
|
||||||
try {
|
try {
|
||||||
errors = evaluateScript(out, err, args.toArray(new String[args.size()]));
|
errors = evaluateScript(out, err, args.toArray(new String[0]));
|
||||||
} catch (final AssertionError e) {
|
} catch (final AssertionError e) {
|
||||||
final PrintWriter writer = new PrintWriter(err);
|
final PrintWriter writer = new PrintWriter(err);
|
||||||
e.printStackTrace(writer);
|
e.printStackTrace(writer);
|
||||||
|
@ -199,7 +199,7 @@ public class ParallelTestRunner {
|
||||||
final ByteArrayOutputStream err = new ByteArrayOutputStream();
|
final ByteArrayOutputStream err = new ByteArrayOutputStream();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final int errors = evaluateScript(out, err, args.toArray(new String[args.size()]));
|
final int errors = evaluateScript(out, err, args.toArray(new String[0]));
|
||||||
|
|
||||||
if (errors != 0 || err.size() > 0) {
|
if (errors != 0 || err.size() > 0) {
|
||||||
if (expectRunFailure) {
|
if (expectRunFailure) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -108,7 +108,7 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes
|
||||||
int errors;
|
int errors;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
errors = evaluateScript(out, err, args.toArray(new String[args.size()]));
|
errors = evaluateScript(out, err, args.toArray(new String[0]));
|
||||||
} catch (final AssertionError e) {
|
} catch (final AssertionError e) {
|
||||||
final PrintWriter writer = new PrintWriter(err);
|
final PrintWriter writer = new PrintWriter(err);
|
||||||
e.printStackTrace(writer);
|
e.printStackTrace(writer);
|
||||||
|
@ -144,7 +144,7 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes
|
||||||
final File errorFileHandle = new File(errorFileName);
|
final File errorFileHandle = new File(errorFileName);
|
||||||
|
|
||||||
try (OutputStream outputFile = new FileOutputStream(outputFileName); OutputStream errorFile = new FileOutputStream(errorFileName)) {
|
try (OutputStream outputFile = new FileOutputStream(outputFileName); OutputStream errorFile = new FileOutputStream(errorFileName)) {
|
||||||
final int errors = evaluateScript(outputFile, errorFile, args.toArray(new String[args.size()]));
|
final int errors = evaluateScript(outputFile, errorFile, args.toArray(new String[0]));
|
||||||
|
|
||||||
if (errors != 0 || errorFileHandle.length() > 0) {
|
if (errors != 0 || errorFileHandle.length() > 0) {
|
||||||
if (expectRunFailure) {
|
if (expectRunFailure) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -392,7 +392,7 @@ public final class TestFinder {
|
||||||
if (hasOptimisticOverride()) {
|
if (hasOptimisticOverride()) {
|
||||||
final List<String> newList = new ArrayList<>(Arrays.asList(args));
|
final List<String> newList = new ArrayList<>(Arrays.asList(args));
|
||||||
newList.add("--optimistic-types=" + OPTIMISTIC_OVERRIDE);
|
newList.add("--optimistic-types=" + OPTIMISTIC_OVERRIDE);
|
||||||
return newList.toArray(new String[newList.size()]);
|
return newList.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -134,7 +134,7 @@ public class FXShell extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a Nashorn script engine with specified arguments.
|
// Create a Nashorn script engine with specified arguments.
|
||||||
engine = factory.getScriptEngine(args.toArray(new String[args.size()]));
|
engine = factory.getScriptEngine(args.toArray(new String[0]));
|
||||||
|
|
||||||
// Load initial scripts.
|
// Load initial scripts.
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue