8130734: Apply transformations found by netbeans Refactor->Inspect and transform menu
Reviewed-by: hannesw, jlaskey, mhaupt
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Wed Jul 08 17:28:08 2015 +0530
@@ -39,7 +39,7 @@
*/
public final class MemberInfo implements Cloneable {
// class loader of this class
- private static ClassLoader myLoader = MemberInfo.class.getClassLoader();
+ private static final ClassLoader MY_LOADER = MemberInfo.class.getClassLoader();
/**
* The different kinds of available class annotations
@@ -493,7 +493,7 @@
if (type.getSort() == Type.OBJECT) {
try {
- final Class<?> clazz = Class.forName(type.getClassName(), false, myLoader);
+ final Class<?> clazz = Class.forName(type.getClassName(), false, MY_LOADER);
return ScriptObject.class.isAssignableFrom(clazz);
} catch (final ClassNotFoundException cnfe) {
return false;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java Wed Jul 08 17:28:08 2015 +0530
@@ -156,14 +156,14 @@
return null;
}
- private static MethodHandle GET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "get",
+ private static final MethodHandle GET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "get",
MethodType.methodType(Object.class, int.class));
- private static MethodHandle GET_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "get",
+ private static final MethodHandle GET_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "get",
MethodType.methodType(Object.class, Object.class));
- private static MethodHandle LIST_GUARD = Guards.getInstanceOfGuard(List.class);
- private static MethodHandle MAP_GUARD = Guards.getInstanceOfGuard(Map.class);
+ private static final MethodHandle LIST_GUARD = Guards.getInstanceOfGuard(List.class);
+ private static final MethodHandle MAP_GUARD = Guards.getInstanceOfGuard(Map.class);
private enum CollectionType {
ARRAY, LIST, MAP
@@ -287,7 +287,7 @@
if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinites trigger IOOBE
return null; // not an exact integer
}
- return Integer.valueOf(intIndex);
+ return intIndex;
} catch(Exception|Error e) {
throw e;
} catch(final Throwable t) {
@@ -343,9 +343,9 @@
}
}
- private static MethodHandle RANGE_CHECK_ARRAY = findRangeCheck(Object.class);
- private static MethodHandle RANGE_CHECK_LIST = findRangeCheck(List.class);
- private static MethodHandle CONTAINS_MAP = Lookup.PUBLIC.findVirtual(Map.class, "containsKey",
+ private static final MethodHandle RANGE_CHECK_ARRAY = findRangeCheck(Object.class);
+ private static final MethodHandle RANGE_CHECK_LIST = findRangeCheck(List.class);
+ private static final MethodHandle CONTAINS_MAP = Lookup.PUBLIC.findVirtual(Map.class, "containsKey",
MethodType.methodType(boolean.class, Object.class));
private static MethodHandle findRangeCheck(final Class<?> collectionType) {
@@ -353,7 +353,7 @@
}
@SuppressWarnings("unused")
- private static final boolean rangeCheck(final Object array, final Object index) {
+ private static boolean rangeCheck(final Object array, final Object index) {
if(!(index instanceof Number)) {
return false;
}
@@ -370,7 +370,7 @@
}
@SuppressWarnings("unused")
- private static final boolean rangeCheck(final List<?> list, final Object index) {
+ private static boolean rangeCheck(final List<?> list, final Object index) {
if(!(index instanceof Number)) {
return false;
}
@@ -386,10 +386,10 @@
throw new IndexOutOfBoundsException("Index: " + n + ", Size: " + list.size());
}
- private static MethodHandle SET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "set",
+ private static final MethodHandle SET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "set",
MethodType.methodType(Object.class, int.class, Object.class));
- private static MethodHandle PUT_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "put",
+ private static final MethodHandle PUT_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "put",
MethodType.methodType(Object.class, Object.class, Object.class));
private GuardedInvocationComponent getElementSetter(final CallSiteDescriptor callSiteDescriptor,
@@ -471,16 +471,16 @@
gic.getValidatorClass(), gic.getValidationType());
}
- private static MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
+ private static final MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
MethodType.methodType(int.class, Object.class));
- private static MethodHandle GET_COLLECTION_LENGTH = Lookup.PUBLIC.findVirtual(Collection.class, "size",
+ private static final MethodHandle GET_COLLECTION_LENGTH = Lookup.PUBLIC.findVirtual(Collection.class, "size",
MethodType.methodType(int.class));
- private static MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
+ private static final MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
MethodType.methodType(int.class));
- private static MethodHandle COLLECTION_GUARD = Guards.getInstanceOfGuard(Collection.class);
+ private static final MethodHandle COLLECTION_GUARD = Guards.getInstanceOfGuard(Collection.class);
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
assertParameterCount(callSiteDescriptor, 1);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java Wed Jul 08 17:28:08 2015 +0530
@@ -164,7 +164,7 @@
}
}
if(b == null) {
- return name.toString();
+ return name;
}
assert lastEscape != -1;
b.append(name, lastEscape + 1, l);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java Wed Jul 08 17:28:08 2015 +0530
@@ -166,7 +166,7 @@
}
};
- private static final ClassLoader getClassLoader(final Class<?> clazz) {
+ private static ClassLoader getClassLoader(final Class<?> clazz) {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
@@ -298,7 +298,7 @@
* @return true if there can be a conversion, false if there can not.
*/
public boolean canConvert(final Class<?> from, final Class<?> to) {
- return canAutoConvert(from, to) || canConvert.get(from).get(to).booleanValue();
+ return canAutoConvert(from, to) || canConvert.get(from).get(to);
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/Formatter.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/Formatter.java Wed Jul 08 17:28:08 2015 +0530
@@ -170,7 +170,7 @@
* @return true if '<' is in the string, else false
*/
private static boolean isPreviousArgument(final String s) {
- return (s != null && s.indexOf('<') >= 0) ? true : false;
+ return (s != null && s.indexOf('<') >= 0);
}
// %[argument_index$][flags][width][.precision][t]conversion
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java Wed Jul 08 17:28:08 2015 +0530
@@ -705,7 +705,7 @@
/** private access */
PRIVATE(ACC_PRIVATE);
- private int value;
+ private final int value;
private Flag(final int value) {
this.value = value;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Wed Jul 08 17:28:08 2015 +0530
@@ -213,7 +213,7 @@
private static final Type ITERATOR_TYPE = Type.typeFor(ITERATOR_CLASS);
private static final Type EXCEPTION_TYPE = Type.typeFor(CompilerConstants.EXCEPTION_PREFIX.type());
- private static final Integer INT_ZERO = Integer.valueOf(0);
+ private static final Integer INT_ZERO = 0;
/** Constant data & installation. The only reason the compiler keeps this is because it is assigned
* by reflection in class installation */
@@ -742,7 +742,7 @@
method.convert(Type.NUMBER);
}
- private static final Type undefinedToNumber(final Type type) {
+ private static Type undefinedToNumber(final Type type) {
return type == Type.UNDEFINED ? Type.NUMBER : type;
}
@@ -4877,7 +4877,7 @@
if(propertyValue instanceof String || propertyValue == null) {
method.load((String)propertyValue);
} else if(propertyValue instanceof Integer) {
- method.load(((Integer)propertyValue).intValue());
+ method.load(((Integer)propertyValue));
method.convert(Type.OBJECT);
} else {
throw new AssertionError();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java Wed Jul 08 17:28:08 2015 +0530
@@ -56,7 +56,7 @@
private transient Class<?> clazz;
- private transient Map<FunctionNode, RecompilableScriptFunctionData> functions = new IdentityHashMap<>();
+ private final transient Map<FunctionNode, RecompilableScriptFunctionData> functions = new IdentityHashMap<>();
private transient boolean isUsed;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Wed Jul 08 17:28:08 2015 +0530
@@ -437,7 +437,7 @@
baseName = baseName.replace('.', '_').replace('-', '_');
if (!env._loader_per_compile) {
- baseName = baseName + installer.getUniqueScriptId();
+ baseName += installer.getUniqueScriptId();
}
// ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ConstantData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ConstantData.java Wed Jul 08 17:28:08 2015 +0530
@@ -162,7 +162,7 @@
final Integer value = stringMap.get(string);
if (value != null) {
- return value.intValue();
+ return value;
}
constants.add(string);
@@ -191,7 +191,7 @@
final Integer value = objectMap.get(entry);
if (value != null) {
- return value.intValue();
+ return value;
}
constants.add(object);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/DumpBytecode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/DumpBytecode.java Wed Jul 08 17:28:08 2015 +0530
@@ -51,7 +51,7 @@
if (env._print_code) {
final StringBuilder sb = new StringBuilder();
- sb.append("class: " + className).
+ sb.append("class: ").append(className).
append('\n').
append(ClassEmitter.disassemble(bytecode)).
append("=====");
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java Wed Jul 08 17:28:08 2015 +0530
@@ -121,11 +121,9 @@
private static boolean definedInBlock(final Block block, final Symbol symbol) {
if (symbol.isGlobal()) {
- if (block.isGlobalScope()) {
- return true;
- }
//globals cannot be defined anywhere else
- return false;
+
+ return block.isGlobalScope();
}
return block.getExistingSymbol(symbol.getName()) == symbol;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Wed Jul 08 17:28:08 2015 +0530
@@ -272,12 +272,12 @@
}
private static class SymbolConversions {
- private static byte I2L = 1 << 0;
- private static byte I2D = 1 << 1;
- private static byte I2O = 1 << 2;
- private static byte L2D = 1 << 3;
- private static byte L2O = 1 << 4;
- private static byte D2O = 1 << 5;
+ private static final byte I2L = 1 << 0;
+ private static final byte I2D = 1 << 1;
+ private static final byte I2O = 1 << 2;
+ private static final byte L2D = 1 << 3;
+ private static final byte L2O = 1 << 4;
+ private static final byte D2O = 1 << 5;
private byte conversions;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Wed Jul 08 17:28:08 2015 +0530
@@ -101,7 +101,7 @@
// Conservative pattern to test if element names consist of characters valid for identifiers.
// This matches any non-zero length alphanumeric string including _ and $ and not starting with a digit.
- private static Pattern SAFE_PROPERTY_NAME = Pattern.compile("[a-zA-Z_$][\\w$]*");
+ private static final Pattern SAFE_PROPERTY_NAME = Pattern.compile("[a-zA-Z_$][\\w$]*");
/**
* Constructor.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java Wed Jul 08 17:28:08 2015 +0530
@@ -89,7 +89,7 @@
public Type ldc(final MethodVisitor method, final Object c) {
assert c instanceof Integer;
- final int value = ((Integer) c).intValue();
+ final int value = ((Integer) c);
switch (value) {
case -1:
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornClassReader.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornClassReader.java Wed Jul 08 17:28:08 2015 +0530
@@ -88,7 +88,7 @@
c = bytecode[i++];
switch (st) {
case 0:
- c = c & 0xFF;
+ c &= 0xFF;
if (c < 0x80) { // 0xxxxxxx
buf[strLen++] = (char) c;
} else if (c < 0xE0 && c > 0xBF) { // 110x xxxx 10xx xxxx
@@ -457,7 +457,7 @@
@SuppressWarnings("unused")
final String getType() {
- String str = type[tag];
+ String str = TYPE[tag];
while (str.length() < 16) {
str += " ";
}
@@ -507,7 +507,7 @@
}
}
- private static String type[] = {
+ private static final String[] TYPE = {
//0
"<error>",
//1
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornTextifier.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornTextifier.java Wed Jul 08 17:28:08 2015 +0530
@@ -535,7 +535,7 @@
addText(sb);
}
- private static final boolean noFallThru(final int opcode) {
+ private static boolean noFallThru(final int opcode) {
switch (opcode) {
case Opcodes.GOTO:
case Opcodes.ATHROW:
@@ -901,7 +901,7 @@
appendDescriptor(sb, INTERNAL_NAME, desc);
}
} else if (o[i] instanceof Integer) {
- switch (((Integer)o[i]).intValue()) {
+ switch (((Integer)o[i])) {
case 0:
appendDescriptor(sb, FIELD_DESCRIPTOR, "T");
break;
@@ -1090,7 +1090,7 @@
public String toString() {
final StringBuilder sb = new StringBuilder();
- sb.append("digraph " + dottyFriendly(name) + " {");
+ sb.append("digraph ").append(dottyFriendly(name)).append(" {");
sb.append("\n");
sb.append("\tgraph [fontname=courier]\n");
sb.append("\tnode [style=filled,color="+COLOR_DEFAULT+",fontname=courier]\n");
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java Wed Jul 08 17:28:08 2015 +0530
@@ -450,7 +450,7 @@
for (final Object mp : memoryPoolMXBeans) {
final Object usage = getUsage.invoke(mp);
final Object max = getMax.invoke(usage);
- maxMemory += ((Long)max).longValue();
+ maxMemory += ((Long)max);
}
} catch (IllegalAccessException |
IllegalArgumentException |
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java Wed Jul 08 17:28:08 2015 +0530
@@ -1874,7 +1874,7 @@
//TODO - fold these into the Link logics, but I'll do that as a later step, as I want to do a checkin
//where everything works first
- private static final <T> ContinuousArrayData getContinuousNonEmptyArrayDataCCE(final Object self, final Class<T> clazz) {
+ private static <T> ContinuousArrayData getContinuousNonEmptyArrayDataCCE(final Object self, final Class<T> clazz) {
try {
@SuppressWarnings("unchecked")
final ContinuousArrayData data = (ContinuousArrayData)(T)((NativeArray)self).getArray();
@@ -1887,7 +1887,7 @@
throw new ClassCastException();
}
- private static final ContinuousArrayData getContinuousArrayDataCCE(final Object self) {
+ private static ContinuousArrayData getContinuousArrayDataCCE(final Object self) {
try {
return (ContinuousArrayData)((NativeArray)self).getArray();
} catch (final NullPointerException e) {
@@ -1895,7 +1895,7 @@
}
}
- private static final ContinuousArrayData getContinuousArrayDataCCE(final Object self, final Class<?> elementType) {
+ private static ContinuousArrayData getContinuousArrayDataCCE(final Object self, final Class<?> elementType) {
try {
return (ContinuousArrayData)((NativeArray)self).getArray(elementType); //ensure element type can fit "elementType"
} catch (final NullPointerException e) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java Wed Jul 08 17:28:08 2015 +0530
@@ -218,7 +218,7 @@
@Override
public String toString() {
- return isValidDate() ? toString(this).toString() : INVALID_DATE;
+ return isValidDate() ? toString(this) : INVALID_DATE;
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java Wed Jul 08 17:28:08 2015 +0530
@@ -803,7 +803,7 @@
private static final Object REPLACE_VALUE = new Object();
- private static final MethodHandle getReplaceValueInvoker() {
+ private static MethodHandle getReplaceValueInvoker() {
return Global.instance().getDynamicInvoker(REPLACE_VALUE,
new Callable<MethodHandle>() {
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Wed Jul 08 17:28:08 2015 +0530
@@ -1044,9 +1044,9 @@
try {
final long value = Long.parseLong(valueString, radix);
if(value >= MIN_INT_L && value <= MAX_INT_L) {
- return Integer.valueOf((int)value);
+ return (int)value;
}
- return Long.valueOf(value);
+ return value;
} catch (final NumberFormatException e) {
if (radix == 10) {
return Double.valueOf(valueString);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Wed Jul 08 17:28:08 2015 +0530
@@ -994,7 +994,7 @@
* @return a long
*/
public static long toLong(final Object obj) {
- return obj instanceof Long ? ((Long)obj).longValue() : toLong(toNumber(obj));
+ return obj instanceof Long ? ((Long)obj) : toLong(toNumber(obj));
}
/**
@@ -1056,7 +1056,7 @@
*/
public static int toInt32Optimistic(final Object obj, final int programPoint) {
if (obj != null && obj.getClass() == Integer.class) {
- return ((Integer)obj).intValue();
+ return ((Integer)obj);
}
throw new UnwarrantedOptimismException(obj, programPoint);
}
@@ -1954,11 +1954,11 @@
public static MethodHandle unboxConstant(final Object o) {
if (o != null) {
if (o.getClass() == Integer.class) {
- return MH.constant(int.class, ((Integer)o).intValue());
+ return MH.constant(int.class, ((Integer)o));
} else if (o.getClass() == Long.class) {
- return MH.constant(long.class, ((Long)o).longValue());
+ return MH.constant(long.class, ((Long)o));
} else if (o.getClass() == Double.class) {
- return MH.constant(double.class, ((Double)o).doubleValue());
+ return MH.constant(double.class, ((Double)o));
}
}
return MH.constant(Object.class, o);
@@ -1983,7 +1983,7 @@
}
}
- private static final List<MethodHandle> toUnmodifiableList(final MethodHandle... methodHandles) {
+ private static List<MethodHandle> toUnmodifiableList(final MethodHandle... methodHandles) {
return Collections.unmodifiableList(Arrays.asList(methodHandles));
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Wed Jul 08 17:28:08 2015 +0530
@@ -156,7 +156,7 @@
}
// If the file does not exist, then assume that it's a directory
if (!file.isFile()) {
- name = name + "/";
+ name += "/";
}
try {
return new URL("file", "", name);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticReturnFilters.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticReturnFilters.java Wed Jul 08 17:28:08 2015 +0530
@@ -260,7 +260,7 @@
final Class<?> c = arg.getClass();
if (c == Long.class) {
// Must check for Long separately, as Long.doubleValue() isn't precise.
- return ((Long)arg).longValue();
+ return ((Long)arg);
} else if (c == Integer.class || c == Double.class || c == Float.class || c == Short.class ||
c == Byte.class) {
return ensureLong(((Number)arg).doubleValue(), programPoint);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java Wed Jul 08 17:28:08 2015 +0530
@@ -359,9 +359,9 @@
if (returnValue instanceof String) {
str = '\'' + str + '\'';
} else if (returnValue instanceof Double) {
- str = str + 'd';
+ str += 'd';
} else if (returnValue instanceof Long) {
- str = str + 'l';
+ str += 'l';
}
return str;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Wed Jul 08 17:28:08 2015 +0530
@@ -611,7 +611,7 @@
obj = ((ScriptObject)obj).get(property);
if(Global.isLocationPropertyPlaceholder(obj)) {
if(CompilerConstants.__LINE__.name().equals(property)) {
- obj = Integer.valueOf(0);
+ obj = 0;
} else {
obj = "";
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Wed Jul 08 17:28:08 2015 +0530
@@ -1031,7 +1031,7 @@
": " +
ECMAErrors.getMessage(
"io.error.cant.write",
- dir.toString() +
+ dir +
" : " + ioExp.toString()));
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java Wed Jul 08 17:28:08 2015 +0530
@@ -215,11 +215,8 @@
int.class);
@SuppressWarnings("unused")
- private static final boolean guard(final Class<? extends ContinuousArrayData> clazz, final ScriptObject sobj) {
- if (sobj != null && sobj.getArray().getClass() == clazz) {
- return true;
- }
- return false;
+ private static boolean guard(final Class<? extends ContinuousArrayData> clazz, final ScriptObject sobj) {
+ return sobj != null && sobj.getArray().getClass() == clazz;
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java Wed Jul 08 17:28:08 2015 +0530
@@ -138,7 +138,7 @@
final Object[] oarray = new Object[trim ? len : array.length];
for (int index = 0; index < len; index++) {
- oarray[index] = Integer.valueOf(array[index]);
+ oarray[index] = array[index];
}
return oarray;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java Wed Jul 08 17:28:08 2015 +0530
@@ -91,7 +91,7 @@
final Object[] oarray = new Object[trim ? len : array.length];
for (int index = 0; index < len; index++) {
- oarray[index] = Long.valueOf(array[index]);
+ oarray[index] = array[index];
}
return oarray;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java Wed Jul 08 17:28:08 2015 +0530
@@ -91,7 +91,7 @@
final Object[] oarray = new Object[trim ? len : array.length];
for (int index = 0; index < len; index++) {
- oarray[index] = Double.valueOf(array[index]);
+ oarray[index] = array[index];
}
return oarray;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java Wed Jul 08 17:28:08 2015 +0530
@@ -95,11 +95,11 @@
final TreeMap<Long, Object> newSparseMap = new TreeMap<>();
for (final Map.Entry<Long, Object> entry : sparseMap.entrySet()) {
- final long newIndex = entry.getKey().longValue() - by;
+ final long newIndex = entry.getKey() - by;
if (newIndex < maxDenseLength) {
underlying = underlying.set((int) newIndex, entry.getValue(), false);
} else if (newIndex >= 0) {
- newSparseMap.put(Long.valueOf(newIndex), entry.getValue());
+ newSparseMap.put(newIndex, entry.getValue());
}
}
@@ -114,7 +114,7 @@
if (len + by > maxDenseLength) {
for (long i = maxDenseLength - by; i < len; i++) {
if (underlying.has((int) i)) {
- newSparseMap.put(Long.valueOf(i + by), underlying.getObject((int) i));
+ newSparseMap.put(i + by, underlying.getObject((int) i));
}
}
underlying = underlying.shrink((int) (maxDenseLength - by));
@@ -123,8 +123,8 @@
underlying.shiftRight(by);
for (final Map.Entry<Long, Object> entry : sparseMap.entrySet()) {
- final long newIndex = entry.getKey().longValue() + by;
- newSparseMap.put(Long.valueOf(newIndex), entry.getValue());
+ final long newIndex = entry.getKey() + by;
+ newSparseMap.put(newIndex, entry.getValue());
}
sparseMap = newSparseMap;
@@ -158,7 +158,7 @@
setLength(newLength);
}
- sparseMap.subMap(Long.valueOf(newLength), Long.MAX_VALUE).clear();
+ sparseMap.subMap(newLength, Long.MAX_VALUE).clear();
setLength(newLength);
return this;
}
@@ -333,7 +333,7 @@
}
private static Long indexToKey(final int index) {
- return Long.valueOf(ArrayIndex.toLongIndex(index));
+ return ArrayIndex.toLongIndex(index);
}
@Override
@@ -355,7 +355,7 @@
return result;
}
setLength(len - 1);
- final Long key = Long.valueOf(len - 1);
+ final Long key = len - 1;
return sparseMap.containsKey(key) ? sparseMap.remove(key) : ScriptRuntime.UNDEFINED;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java Wed Jul 08 17:28:08 2015 +0530
@@ -47,7 +47,6 @@
import jdk.internal.dynalink.support.TypeUtilities;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
import jdk.nashorn.internal.lookup.MethodHandleFactory;
import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
import jdk.nashorn.internal.objects.ScriptFunctionImpl;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java Wed Jul 08 17:28:08 2015 +0530
@@ -107,7 +107,7 @@
if (o instanceof Number) {
final int ival = ((Number)o).intValue();
if (ival >= Character.MIN_VALUE && ival <= Character.MAX_VALUE) {
- return Character.valueOf((char) ival);
+ return (char) ival;
}
throw typeError("cant.convert.number.to.char");
@@ -196,13 +196,13 @@
return ((Integer)obj).longValue();
} else if (obj instanceof Double) {
final Double d = (Double)obj;
- if(Double.isInfinite(d.doubleValue())) {
+ if(Double.isInfinite(d)) {
return 0L;
}
return d.longValue();
} else if (obj instanceof Float) {
final Float f = (Float)obj;
- if(Float.isInfinite(f.floatValue())) {
+ if(Float.isInfinite(f)) {
return 0L;
}
return f.longValue();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java Wed Jul 08 17:28:08 2015 +0530
@@ -101,9 +101,7 @@
}
public void copy(final BitSet other) {
- for (int i=0; i<BITSET_SIZE; i++) {
- bits[i] = other.bits[i];
- }
+ System.arraycopy(other.bits, 0, bits, 0, BITSET_SIZE);
}
public int numOn() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java Wed Jul 08 17:28:08 2015 +0530
@@ -38,7 +38,7 @@
final StringBuilder sb = new StringBuilder();
sb.append("Region: \n");
for (int i=0; i<beg.length; i++) {
- sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")");
+ sb.append(" ").append(i).append(": (").append(beg[i]).append("-").append(end[i]).append(")");
}
return sb.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -60,8 +60,8 @@
@Override
public String toString(final int level) {
final StringBuilder value = new StringBuilder();
- value.append("\n type: " + typeToString());
- value.append("\n target: " + pad(target, level + 1));
+ value.append("\n type: ").append(typeToString());
+ value.append("\n target: ").append(pad(target, level + 1));
return value.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -124,9 +124,9 @@
@Override
public String toString(final int level) {
final StringBuilder value = new StringBuilder();
- value.append("\n flags: " + flagsToString());
- value.append("\n bs: " + pad(bs, level + 1));
- value.append("\n mbuf: " + pad(mbuf, level + 1));
+ value.append("\n flags: ").append(flagsToString());
+ value.append("\n bs: ").append(pad(bs, level + 1));
+ value.append("\n mbuf: ").append(pad(mbuf, level + 1));
return value.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -148,8 +148,8 @@
@Override
public String toString(final int level) {
final StringBuilder value = new StringBuilder();
- value.append("\n car: " + pad(car, level + 1));
- value.append("\n cdr: " + (cdr == null ? "NULL" : cdr.toString()));
+ value.append("\n car: ").append(pad(car, level + 1));
+ value.append("\n cdr: ").append(cdr == null ? "NULL" : cdr.toString());
return value.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -80,15 +80,15 @@
@Override
public String toString(final int level) {
final StringBuilder value = new StringBuilder(super.toString(level));
- value.append("\n type: " + typeToString());
- value.append("\n regNum: " + regNum);
- value.append("\n option: " + Option.toString(option));
- value.append("\n target: " + pad(target, level + 1));
- value.append("\n callAddr: " + callAddr);
- value.append("\n minLength: " + minLength);
- value.append("\n maxLength: " + maxLength);
- value.append("\n charLength: " + charLength);
- value.append("\n optCount: " + optCount);
+ value.append("\n type: ").append(typeToString());
+ value.append("\n regNum: ").append(regNum);
+ value.append("\n option: ").append(Option.toString(option));
+ value.append("\n target: ").append(pad(target, level + 1));
+ value.append("\n callAddr: ").append(callAddr);
+ value.append("\n minLength: ").append(minLength);
+ value.append("\n maxLength: ").append(maxLength);
+ value.append("\n charLength: ").append(charLength);
+ value.append("\n optCount: ").append(optCount);
return value.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java Wed Jul 08 17:28:08 2015 +0530
@@ -85,7 +85,7 @@
@Override
public final String toString() {
final StringBuilder s = new StringBuilder();
- s.append("<" + getAddressName() + " (" + (parent == null ? "NULL" : parent.getAddressName()) + ")>");
+ s.append("<").append(getAddressName()).append(" (").append(parent == null ? "NULL" : parent.getAddressName()).append(")>");
return s + toString(0);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -118,14 +118,14 @@
@Override
public String toString(final int level) {
final StringBuilder value = new StringBuilder(super.toString(level));
- value.append("\n target: " + pad(target, level + 1));
- value.append("\n lower: " + lower);
- value.append("\n upper: " + upper);
- value.append("\n greedy: " + greedy);
- value.append("\n targetEmptyInfo: " + targetEmptyInfo);
- value.append("\n headExact: " + pad(headExact, level + 1));
- value.append("\n nextHeadExact: " + pad(nextHeadExact, level + 1));
- value.append("\n isRefered: " + isRefered);
+ value.append("\n target: ").append(pad(target, level + 1));
+ value.append("\n lower: ").append(lower);
+ value.append("\n upper: ").append(upper);
+ value.append("\n greedy: ").append(greedy);
+ value.append("\n targetEmptyInfo: ").append(targetEmptyInfo);
+ value.append("\n headExact: ").append(pad(headExact, level + 1));
+ value.append("\n nextHeadExact: ").append(pad(nextHeadExact, level + 1));
+ value.append("\n isRefered: ").append(isRefered);
return value.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java Wed Jul 08 17:28:08 2015 +0530
@@ -71,7 +71,7 @@
final char[] tmp = new char[len + NODE_STR_MARGIN];
System.arraycopy(chars, p, tmp, 0, end - p);
chars = tmp;
- end = end - p;
+ end -= p;
p = 0;
clearShared();
} else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Wed Jul 08 17:28:08 2015 +0530
@@ -54,7 +54,6 @@
import jdk.nashorn.internal.runtime.ScriptEnvironment;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptRuntime;
-import jdk.nashorn.internal.runtime.Source;
import jdk.nashorn.internal.runtime.options.Options;
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/ShellFunctions.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/ShellFunctions.java Wed Jul 08 17:28:08 2015 +0530
@@ -29,10 +29,8 @@
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import java.io.BufferedReader;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import jdk.nashorn.internal.runtime.JSType;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java Wed Jul 08 17:28:08 2015 +0530
@@ -176,7 +176,7 @@
}
public Boolean booleanBoxingMethod(final Boolean arg) {
- return !arg.booleanValue();
+ return !arg;
}
public boolean[] booleanArrayMethod(final boolean arg[]) {
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java Wed Jul 08 17:28:08 2015 +0530
@@ -573,7 +573,7 @@
}
// properties that can be read by any code
- private static String[] propNames = {
+ private static final String[] PROP_NAMES = {
"java.version",
"java.vendor",
"java.vendor.url",
@@ -601,7 +601,7 @@
final ScriptEngineManager m = new ScriptEngineManager();
final ScriptEngine e = m.getEngineByName("nashorn");
- for (final String name : propNames) {
+ for (final String name : PROP_NAMES) {
checkProperty(e, name);
}
}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java Wed Jul 08 17:28:08 2015 +0530
@@ -278,7 +278,7 @@
ScriptObjectMirror obj = (ScriptObjectMirror)e.eval(
"({ valueOf: function() { return 42 } })");
- assertEquals(Double.valueOf(42.0), obj.to(Double.class));
+ assertEquals(42.0, obj.to(Double.class));
obj = (ScriptObjectMirror)e.eval(
"({ toString: function() { return 'foo' } })");
--- a/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java Wed Jul 08 17:28:08 2015 +0530
@@ -67,7 +67,7 @@
parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
@Override
public boolean exclude(final File file, final String content) {
- return content.indexOf("@negative") != -1;
+ return content.contains("@negative");
}
});
}
--- a/nashorn/test/src/jdk/nashorn/internal/performance/OctaneTest.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/performance/OctaneTest.java Wed Jul 08 17:28:08 2015 +0530
@@ -272,10 +272,10 @@
Double nashornToRhino = null;
Double nashornToV8 = null;
if (rhino != null && rhino != 0) {
- nashornToRhino = nashorn.doubleValue() / rhino.doubleValue();
+ nashornToRhino = nashorn / rhino;
}
if (v8 != null && rhino != 0) {
- nashornToV8 = nashorn.doubleValue() / v8.doubleValue();
+ nashornToV8 = nashorn / v8;
}
final String normalizedBenchmark=benchmark.replace("-", "");
System.out.println("benchmark-" + normalizedBenchmark + "-nashorn=" + nashorn);
@@ -300,20 +300,12 @@
boolean checkRhinoPresence() {
final String rhinojar = System.getProperty("rhino.jar");
- if (rhinojar != null) {
- // System.out.println("Rhino jar found; performing comparison testing");
- return true;
- }
- return false;
+ return rhinojar != null;
}
boolean checkV8Presence() {
final String v8shell = System.getProperty("v8.shell.full.path");
- if (v8shell != null) {
- // System.out.println("d8 found; performing comparison testing");
- return true;
- }
- return false;
+ return v8shell != null;
}
}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java Wed Jul 08 17:28:08 2015 +0530
@@ -62,7 +62,7 @@
@Test
public void unwarrantedOptimismExceptionNotSerializable() {
- tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128));
+ tryToSerialize(new UnwarrantedOptimismException(1.0, 128));
}
private static void tryToSerialize(final Object obj) {
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Wed Jul 08 17:28:08 2015 +0530
@@ -159,7 +159,7 @@
forkJVMOptions = (vmOptions != null)? vmOptions.split(" ") : new String[0];
}
- private static ThreadLocal<ScriptEvaluator> evaluators = new ThreadLocal<>();
+ private static final ThreadLocal<ScriptEvaluator> EVALUATORS = new ThreadLocal<>();
/**
* Create a script evaluator or return from cache
@@ -167,7 +167,7 @@
*/
protected ScriptEvaluator getEvaluator() {
synchronized (AbstractScriptRunnable.class) {
- ScriptEvaluator evaluator = evaluators.get();
+ ScriptEvaluator evaluator = EVALUATORS.get();
if (evaluator == null) {
if (sharedContext) {
final String[] args;
@@ -177,10 +177,10 @@
args = new String[] { framework };
}
evaluator = new SharedContextEvaluator(args);
- evaluators.set(evaluator);
+ EVALUATORS.set(evaluator);
} else {
evaluator = new SeparateContextEvaluator();
- evaluators.set(evaluator);
+ EVALUATORS.set(evaluator);
}
}
return evaluator;
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Wed Jul 08 17:28:08 2015 +0530
@@ -378,7 +378,7 @@
* @return true if optimistic type override has been set by test suite
*/
public static boolean hasOptimisticOverride() {
- return Boolean.valueOf(OPTIMISTIC_OVERRIDE).toString().equals(System.getProperty("optimistic.override"));
+ return Boolean.toString(OPTIMISTIC_OVERRIDE).equals(System.getProperty("optimistic.override"));
}
/**
@@ -391,8 +391,8 @@
public static String[] addExplicitOptimisticTypes(final String[] args) {
if (hasOptimisticOverride()) {
final List<String> newList = new ArrayList<>(Arrays.asList(args));
- newList.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE));
- return newList.toArray(new String[0]);
+ newList.add("--optimistic-types=" + OPTIMISTIC_OVERRIDE);
+ return newList.toArray(new String[newList.size()]);
}
return args;
}
@@ -405,7 +405,7 @@
*/
public static void addExplicitOptimisticTypes(final List<String> args) {
if (hasOptimisticOverride()) {
- args.add("--optimistic-types=" + Boolean.valueOf(OPTIMISTIC_OVERRIDE));
+ args.add("--optimistic-types=" + OPTIMISTIC_OVERRIDE);
}
}
--- a/nashorn/test/src/jdk/nashorn/test/models/JDK_8081015_TestModel.java Tue Jul 07 18:33:24 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/test/models/JDK_8081015_TestModel.java Wed Jul 08 17:28:08 2015 +0530
@@ -64,9 +64,9 @@
private static void walkCollection(final Collection<Object> c) {
final Iterator<Object> it = c.iterator();
- assertEquals(it.next(), Integer.valueOf(1));
- assertEquals(it.next(), Integer.valueOf(2));
- assertEquals(it.next(), Double.valueOf(3.3));
+ assertEquals(it.next(), 1);
+ assertEquals(it.next(), 2);
+ assertEquals(it.next(), 3.3);
assertEquals(it.next(), "foo");
assertFalse(it.hasNext());
}