--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Thu Oct 06 16:27:47 2016 +0200
@@ -574,7 +574,7 @@
String getDocumentationKey(final String objName) {
if (kind == Kind.FUNCTION) {
- StringBuilder buf = new StringBuilder(objName);
+ final StringBuilder buf = new StringBuilder(objName);
switch (where) {
case CONSTRUCTOR:
break;
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java Thu Oct 06 16:27:47 2016 +0200
@@ -42,7 +42,7 @@
*
*/
public final class ScriptClassInfo {
- private static String getTypeDescriptor(String pkg, String name) {
+ private static String getTypeDescriptor(final String pkg, final String name) {
return "L" + pkg + name + ";";
}
--- a/nashorn/samples/dynalink/ArrayStreamLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/ArrayStreamLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -30,7 +30,6 @@
*/
import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.ArrayList;
import java.util.List;
@@ -43,12 +42,12 @@
import jdk.dynalink.NamedOperation;
import jdk.dynalink.Operation;
import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.GuardingDynamicLinkerExporter;
-import jdk.dynalink.linker.GuardedInvocation;
-import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
+import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.support.Guards;
import jdk.dynalink.linker.support.Lookup;
@@ -65,7 +64,7 @@
System.out.println("pluggable dynalink array stream linker loaded");
}
- public static Object arrayToStream(Object array) {
+ public static Object arrayToStream(final Object array) {
if (array instanceof int[]) {
return IntStream.of((int[])array);
} else if (array instanceof long[]) {
@@ -95,17 +94,17 @@
}
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request,
- LinkerServices linkerServices) throws Exception {
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request,
+ final LinkerServices linkerServices) throws Exception {
final Object self = request.getReceiver();
if (self == null || !canLinkType(self.getClass())) {
return null;
}
- CallSiteDescriptor desc = request.getCallSiteDescriptor();
- Operation op = desc.getOperation();
- Object name = NamedOperation.getName(op);
- boolean getProp = CompositeOperation.contains(
+ final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+ final Operation op = desc.getOperation();
+ final Object name = NamedOperation.getName(op);
+ final boolean getProp = CompositeOperation.contains(
NamedOperation.getBaseOperation(op),
StandardOperation.GET_PROPERTY);
if (getProp && "stream".equals(name)) {
--- a/nashorn/samples/dynalink/BufferIndexingLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/BufferIndexingLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -30,10 +30,7 @@
*/
import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
-import java.util.ArrayList;
-import java.util.List;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -42,17 +39,19 @@
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import java.nio.ShortBuffer;
+import java.util.ArrayList;
+import java.util.List;
import jdk.dynalink.CallSiteDescriptor;
import jdk.dynalink.CompositeOperation;
import jdk.dynalink.NamedOperation;
import jdk.dynalink.Operation;
import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.GuardingDynamicLinkerExporter;
-import jdk.dynalink.linker.GuardedInvocation;
-import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
+import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.support.Guards;
import jdk.dynalink.linker.support.Lookup;
@@ -94,7 +93,7 @@
private static final MethodType GUARD_TYPE;
static {
- Lookup look = Lookup.PUBLIC;
+ final Lookup look = Lookup.PUBLIC;
BUFFER_LIMIT = look.findVirtual(Buffer.class, "limit", MethodType.methodType(int.class));
BYTEBUFFER_GET = look.findVirtual(ByteBuffer.class, "get",
MethodType.methodType(byte.class, int.class));
@@ -163,15 +162,15 @@
}
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request,
- LinkerServices linkerServices) throws Exception {
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request,
+ final LinkerServices linkerServices) throws Exception {
final Object self = request.getReceiver();
if (self == null || !canLinkType(self.getClass())) {
return null;
}
- CallSiteDescriptor desc = request.getCallSiteDescriptor();
- StandardOperation op = getFirstStandardOperation(desc);
+ final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+ final StandardOperation op = getFirstStandardOperation(desc);
if (op == null) {
return null;
}
@@ -182,7 +181,7 @@
case SET_ELEMENT:
return linkSetElement(self);
case GET_PROPERTY: {
- Object name = NamedOperation.getName(desc.getOperation());
+ final Object name = NamedOperation.getName(desc.getOperation());
if ("length".equals(name)) {
return linkLength();
}
@@ -195,7 +194,7 @@
return linkers;
}
- private static GuardedInvocation linkGetElement(Object self) {
+ private static GuardedInvocation linkGetElement(final Object self) {
MethodHandle method = null;
MethodHandle guard = null;
if (self instanceof ByteBuffer) {
@@ -224,7 +223,7 @@
return method != null? new GuardedInvocation(method, guard) : null;
}
- private static GuardedInvocation linkSetElement(Object self) {
+ private static GuardedInvocation linkSetElement(final Object self) {
MethodHandle method = null;
MethodHandle guard = null;
if (self instanceof ByteBuffer) {
--- a/nashorn/samples/dynalink/DOMLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/DOMLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -39,18 +39,17 @@
import jdk.dynalink.NamedOperation;
import jdk.dynalink.Operation;
import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.GuardingDynamicLinkerExporter;
-import jdk.dynalink.linker.GuardedInvocation;
-import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
+import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.support.Guards;
import jdk.dynalink.linker.support.Lookup;
-import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
/**
* This is a dynalink pluggable linker (see http://openjdk.java.net/jeps/276).
@@ -65,12 +64,12 @@
}
// return List of child Elements of the given Element matching the given name.
- private static List<Element> getChildElements(Element elem, String name) {
- NodeList nodeList = elem.getChildNodes();
- List<Element> childElems = new ArrayList<>();
- int len = nodeList.getLength();
+ private static List<Element> getChildElements(final Element elem, final String name) {
+ final NodeList nodeList = elem.getChildNodes();
+ final List<Element> childElems = new ArrayList<>();
+ final int len = nodeList.getLength();
for (int i = 0; i < len; i++) {
- Node node = nodeList.item(i);
+ final Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE &&
((Element)node).getTagName().equals(name)) {
childElems.add((Element)node);
@@ -81,18 +80,18 @@
// method that returns either unique child element matching given name
// or a list of child elements of that name (if there are more than one matches).
- public static Object getElementsByName(Object elem, final String name) {
- List<Element> elems = getChildElements((Element)elem, name);
+ public static Object getElementsByName(final Object elem, final String name) {
+ final List<Element> elems = getChildElements((Element)elem, name);
return elems.size() == 1? elems.get(0) : elems;
}
// method to extract text context under a given DOM Element
- public static Object getElementText(Object elem) {
- NodeList nodeList = ((Element)elem).getChildNodes();
- int len = nodeList.getLength();
- StringBuilder text = new StringBuilder();
+ public static Object getElementText(final Object elem) {
+ final NodeList nodeList = ((Element)elem).getChildNodes();
+ final int len = nodeList.getLength();
+ final StringBuilder text = new StringBuilder();
for (int i = 0; i < len; i++) {
- Node node = nodeList.item(i);
+ final Node node = nodeList.item(i);
if (node.getNodeType() == Node.TEXT_NODE) {
text.append(node.getNodeValue());
}
@@ -123,21 +122,21 @@
}
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request,
- LinkerServices linkerServices) throws Exception {
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request,
+ final LinkerServices linkerServices) throws Exception {
final Object self = request.getReceiver();
if (! (self instanceof Element)) {
return null;
}
- CallSiteDescriptor desc = request.getCallSiteDescriptor();
- Operation op = desc.getOperation();
- Object name = NamedOperation.getName(op);
- boolean getProp = CompositeOperation.contains(
+ final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+ final Operation op = desc.getOperation();
+ final Object name = NamedOperation.getName(op);
+ final boolean getProp = CompositeOperation.contains(
NamedOperation.getBaseOperation(op),
StandardOperation.GET_PROPERTY);
if (getProp && name instanceof String) {
- String nameStr = (String)name;
+ final String nameStr = (String)name;
// Treat names starting with "_" as special names.
// Everything else is linked other dynalink bean linker!
--- a/nashorn/samples/dynalink/MissingMethodExample.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/MissingMethodExample.java Thu Oct 06 16:27:47 2016 +0200
@@ -37,13 +37,13 @@
implements MissingMethodHandler {
@Override
- public Object doesNotUnderstand(String name, Object... args) {
+ public Object doesNotUnderstand(final String name, final Object... args) {
// This simple doesNotUnderstand just prints method name and args.
// You can put useful method routing logic here.
System.out.println("you called " + name);
if (args.length != 0) {
System.out.println("arguments are: ");
- for (Object arg : args) {
+ for (final Object arg : args) {
System.out.println(" " + arg);
}
}
--- a/nashorn/samples/dynalink/MissingMethodLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/MissingMethodLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -40,12 +40,12 @@
import jdk.dynalink.Operation;
import jdk.dynalink.StandardOperation;
import jdk.dynalink.beans.BeansLinker;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.GuardingDynamicLinkerExporter;
-import jdk.dynalink.linker.GuardedInvocation;
-import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
+import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.dynalink.linker.support.Guards;
import jdk.dynalink.linker.support.Lookup;
@@ -65,7 +65,7 @@
public static class MissingMethod {
private final String name;
- public MissingMethod(String name) {
+ public MissingMethod(final String name) {
this.name = name;
}
@@ -130,20 +130,20 @@
}
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request,
- LinkerServices linkerServices) throws Exception {
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request,
+ final LinkerServices linkerServices) throws Exception {
final Object self = request.getReceiver();
- CallSiteDescriptor desc = request.getCallSiteDescriptor();
+ final CallSiteDescriptor desc = request.getCallSiteDescriptor();
// any method call is done by two steps. Step (1) GET_METHOD and (2) is CALL
// For step (1), we check if GET_METHOD can succeed by Java linker, if so
// we return that method object. If not, we return a MissingMethod object.
if (self instanceof MissingMethodHandler) {
// Check if this is a named GET_METHOD first.
- boolean isGetMethod = getFirstStandardOperation(desc) == StandardOperation.GET_METHOD;
- Object name = NamedOperation.getName(desc.getOperation());
+ final boolean isGetMethod = getFirstStandardOperation(desc) == StandardOperation.GET_METHOD;
+ final Object name = NamedOperation.getName(desc.getOperation());
if (isGetMethod && name instanceof String) {
- GuardingDynamicLinker javaLinker = beansLinker.getLinkerForClass(self.getClass());
+ final GuardingDynamicLinker javaLinker = beansLinker.getLinkerForClass(self.getClass());
GuardedInvocation inv;
try {
inv = javaLinker.getGuardedInvocation(request, linkerServices);
@@ -151,11 +151,11 @@
inv = null;
}
- String nameStr = name.toString();
+ final String nameStr = name.toString();
if (inv == null) {
// use "this" for just guard and drop it -- return a constant Method handle
// that returns a newly created MissingMethod object
- MethodHandle mh = MethodHandles.constant(Object.class, new MissingMethod(nameStr));
+ final MethodHandle mh = MethodHandles.constant(Object.class, new MissingMethod(nameStr));
inv = new GuardedInvocation(
MethodHandles.dropArguments(mh, 0, Object.class),
Guards.isOfClass(self.getClass(), MethodType.methodType(Boolean.TYPE, Object.class)));
@@ -166,7 +166,7 @@
} else if (self instanceof MissingMethod) {
// This is step (2). We call MissingMethodHandler.doesNotUnderstand here
// Check if this is this a CALL first.
- boolean isCall = getFirstStandardOperation(desc) == StandardOperation.CALL;
+ final boolean isCall = getFirstStandardOperation(desc) == StandardOperation.CALL;
if (isCall) {
MethodHandle mh = DOES_NOT_UNDERSTAND;
--- a/nashorn/samples/dynalink/UnderscoreNameLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/samples/dynalink/UnderscoreNameLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -29,22 +29,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.regex.Matcher;
import jdk.dynalink.CallSiteDescriptor;
import jdk.dynalink.CompositeOperation;
import jdk.dynalink.NamedOperation;
import jdk.dynalink.Operation;
-import jdk.dynalink.CompositeOperation;
import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.GuardingDynamicLinkerExporter;
-import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
import jdk.dynalink.linker.support.SimpleLinkRequest;
@@ -62,9 +58,9 @@
private static final Pattern UNDERSCORE_NAME = Pattern.compile("_(.)");
// translate underscore_separated name as a CamelCase name
- private static String translateToCamelCase(String name) {
- Matcher m = UNDERSCORE_NAME.matcher(name);
- StringBuilder buf = new StringBuilder();
+ private static String translateToCamelCase(final String name) {
+ final Matcher m = UNDERSCORE_NAME.matcher(name);
+ final StringBuilder buf = new StringBuilder();
while (m.find()) {
m.appendReplacement(buf, m.group(1).toUpperCase());
}
@@ -94,28 +90,28 @@
final ArrayList<GuardingDynamicLinker> linkers = new ArrayList<>();
linkers.add(new GuardingDynamicLinker() {
@Override
- public GuardedInvocation getGuardedInvocation(LinkRequest request,
- LinkerServices linkerServices) throws Exception {
+ public GuardedInvocation getGuardedInvocation(final LinkRequest request,
+ final LinkerServices linkerServices) throws Exception {
final Object self = request.getReceiver();
- CallSiteDescriptor desc = request.getCallSiteDescriptor();
- Operation op = desc.getOperation();
- Object name = NamedOperation.getName(op);
+ final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+ final Operation op = desc.getOperation();
+ final Object name = NamedOperation.getName(op);
// is this a named GET_METHOD?
- boolean isGetMethod = getFirstStandardOperation(desc) == StandardOperation.GET_METHOD;
+ final boolean isGetMethod = getFirstStandardOperation(desc) == StandardOperation.GET_METHOD;
if (isGetMethod && name instanceof String) {
- String str = (String)name;
+ final String str = (String)name;
if (str.indexOf('_') == -1) {
return null;
}
- String nameStr = translateToCamelCase(str);
+ final String nameStr = translateToCamelCase(str);
// create a new call descriptor to use translated name
- CallSiteDescriptor newDesc = new CallSiteDescriptor(
+ final CallSiteDescriptor newDesc = new CallSiteDescriptor(
desc.getLookup(),
new NamedOperation(NamedOperation.getBaseOperation(op), nameStr),
desc.getMethodType());
// create a new Link request to link the call site with translated name
- LinkRequest newRequest = new SimpleLinkRequest(newDesc,
+ final LinkRequest newRequest = new SimpleLinkRequest(newDesc,
request.isCallSiteUnstable(), request.getArguments());
// return guarded invocation linking the translated request
return linkerServices.getGuardedInvocation(newRequest);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DestructuringDeclTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DestructuringDeclTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -36,7 +36,7 @@
private final ExpressionTree lhs;
private final ExpressionTree init;
- DestructuringDeclTreeImpl(ExpressionStatement exprStat, final ExpressionTree lhs, final ExpressionTree init) {
+ DestructuringDeclTreeImpl(final ExpressionStatement exprStat, final ExpressionTree lhs, final ExpressionTree init) {
super(exprStat);
assert exprStat.destructuringDeclarationType() != null : "expecting a destructuring decl. statement";
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExportEntryTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ExportEntryTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -39,10 +39,10 @@
private final IdentifierTree localName;
private ExportEntryTreeImpl(final long startPos, final long endPos,
- IdentifierTree exportName,
- IdentifierTree moduleRequest,
- IdentifierTree importName,
- IdentifierTree localName) {
+ final IdentifierTree exportName,
+ final IdentifierTree moduleRequest,
+ final IdentifierTree importName,
+ final IdentifierTree localName) {
super(null); // no underlying Node!
this.startPos = startPos;
this.endPos = endPos;
@@ -52,7 +52,7 @@
this.localName = localName;
}
- private static ExportEntryTreeImpl createExportEntry(Module.ExportEntry entry) {
+ private static ExportEntryTreeImpl createExportEntry(final Module.ExportEntry entry) {
return new ExportEntryTreeImpl(entry.getStartPosition(),
entry.getEndPosition(),
identOrNull(entry.getExportName()),
@@ -61,7 +61,7 @@
identOrNull(entry.getLocalName()));
}
- static List<ExportEntryTreeImpl> createExportList(List<Module.ExportEntry> exportList) {
+ static List<ExportEntryTreeImpl> createExportList(final List<Module.ExportEntry> exportList) {
return exportList.stream().
map(ExportEntryTreeImpl::createExportEntry).
collect(Collectors.toList());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionExpressionTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -51,7 +51,7 @@
this.params = params;
if (node.getFlag(FunctionNode.HAS_EXPRESSION_BODY)) {
- StatementTree first = body.getStatements().get(0);
+ final StatementTree first = body.getStatements().get(0);
assert first instanceof ReturnTree : "consise func. expression should have a return statement";
this.body = ((ReturnTree)first).getExpression();
} else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java Thu Oct 06 16:27:47 2016 +0200
@@ -191,9 +191,9 @@
@Override
public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) {
if (expressionStatement.destructuringDeclarationType() != null) {
- ExpressionTree expr = translateExpr(expressionStatement.getExpression());
+ final ExpressionTree expr = translateExpr(expressionStatement.getExpression());
assert expr instanceof AssignmentTree : "destructuring decl. statement does not have assignment";
- AssignmentTree assign = (AssignmentTree)expr;
+ final AssignmentTree assign = (AssignmentTree)expr;
curStat = new DestructuringDeclTreeImpl(expressionStatement, assign.getVariable(), assign.getExpression());
} else {
curStat = new ExpressionStatementTreeImpl(expressionStatement,
@@ -544,12 +544,12 @@
}
private List<? extends ExpressionTree> translateParameters(final FunctionNode func) {
- Map<IdentNode, Expression> paramExprs = func.getParameterExpressions();
+ final Map<IdentNode, Expression> paramExprs = func.getParameterExpressions();
if (paramExprs != null) {
- List<IdentNode> params = func.getParameters();
+ final List<IdentNode> params = func.getParameters();
final List<ExpressionTreeImpl> exprTrees = new ArrayList<>(params.size());
for (final IdentNode ident : params) {
- Expression expr = paramExprs.containsKey(ident)? paramExprs.get(ident) : ident;
+ final Expression expr = paramExprs.containsKey(ident)? paramExprs.get(ident) : ident;
curExpr = null;
expr.accept(this);
assert curExpr != null;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ImportEntryTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ImportEntryTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -38,9 +38,9 @@
private final IdentifierTree localName;
private ImportEntryTreeImpl(final long startPos, final long endPos,
- IdentifierTree moduleRequest,
- IdentifierTree importName,
- IdentifierTree localName) {
+ final IdentifierTree moduleRequest,
+ final IdentifierTree importName,
+ final IdentifierTree localName) {
super(null); // No underlying Node!
this.startPos = startPos;
this.endPos = endPos;
@@ -49,7 +49,7 @@
this.localName = localName;
}
- private static ImportEntryTreeImpl createImportEntry(Module.ImportEntry entry) {
+ private static ImportEntryTreeImpl createImportEntry(final Module.ImportEntry entry) {
return new ImportEntryTreeImpl(entry.getStartPosition(),
entry.getEndPosition(),
identOrNull(entry.getModuleRequest()),
@@ -57,7 +57,7 @@
identOrNull(entry.getLocalName()));
}
- static List<ImportEntryTreeImpl> createImportList(List<Module.ImportEntry> importList) {
+ static List<ImportEntryTreeImpl> createImportList(final List<Module.ImportEntry> importList) {
return importList.stream().
map(ImportEntryTreeImpl::createImportEntry).
collect(Collectors.toList());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java Thu Oct 06 16:27:47 2016 +0200
@@ -140,7 +140,7 @@
*/
public static Parser create(final String... options) throws IllegalArgumentException {
options.getClass();
- for (String opt : options) {
+ for (final String opt : options) {
switch (opt) {
case "--const-as-var":
case "-dump-on-error":
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -73,9 +73,9 @@
// append "--parse-only to signal to the Nashorn that it
// is being used in "parse only" mode.
- String[] newArgs = Arrays.copyOf(args, args.length + 1, String[].class);
+ final String[] newArgs = Arrays.copyOf(args, args.length + 1, String[].class);
newArgs[args.length] = "--parse-only";
- Options options = new Options("nashorn");
+ final Options options = new Options("nashorn");
options.process(newArgs);
this.env = new ScriptEnvironment(options,
new PrintWriter(System.out), new PrintWriter(System.err));
@@ -142,32 +142,32 @@
}
}
- private CompilationUnitTree parseModule(File file, DiagnosticListener listener) throws IOException, NashornException {
+ private CompilationUnitTree parseModule(final File file, final DiagnosticListener listener) throws IOException, NashornException {
final Source src = Source.sourceFor(Objects.requireNonNull(file).getName(), file);
return makeModule(src, listener);
}
- private CompilationUnitTree parseModule(Path path, DiagnosticListener listener) throws IOException, NashornException {
+ private CompilationUnitTree parseModule(final Path path, final DiagnosticListener listener) throws IOException, NashornException {
final Source src = Source.sourceFor(Objects.requireNonNull(path).toString(), path);
return makeModule(src, listener);
}
- private CompilationUnitTree parseModule(URL url, DiagnosticListener listener) throws IOException, NashornException {
+ private CompilationUnitTree parseModule(final URL url, final DiagnosticListener listener) throws IOException, NashornException {
final Source src = Source.sourceFor(url.toString(), url);
return makeModule(src, listener);
}
- private CompilationUnitTree parseModule(String name, Reader reader, DiagnosticListener listener) throws IOException, NashornException {
+ private CompilationUnitTree parseModule(final String name, final Reader reader, final DiagnosticListener listener) throws IOException, NashornException {
final Source src = Source.sourceFor(Objects.requireNonNull(name), Objects.requireNonNull(reader));
return makeModule(src, listener);
}
- private CompilationUnitTree parseModule(String name, String code, DiagnosticListener listener) throws NashornException {
+ private CompilationUnitTree parseModule(final String name, final String code, final DiagnosticListener listener) throws NashornException {
final Source src = Source.sourceFor(name, code);
return makeModule(src, listener);
}
- private CompilationUnitTree parseModule(ScriptObjectMirror scriptObj, DiagnosticListener listener) throws NashornException {
+ private CompilationUnitTree parseModule(final ScriptObjectMirror scriptObj, final DiagnosticListener listener) throws NashornException {
final Map<?, ?> map = Objects.requireNonNull(scriptObj);
if (map.containsKey("script") && map.containsKey("name")) {
final String script = JSType.toString(map.get("script"));
@@ -179,7 +179,7 @@
}
}
- private CompilationUnitTree makeModule(Source src, DiagnosticListener listener) {
+ private CompilationUnitTree makeModule(final Source src, final DiagnosticListener listener) {
final FunctionNode modFunc = makeParser(src, listener).parseModule(src.getName());
return new IRTranslator().translate(modFunc);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES5_1.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES5_1.java Thu Oct 06 16:27:47 2016 +0200
@@ -70,7 +70,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitModule(ModuleTree node, P p) {
+ public R visitModule(final ModuleTree node, final P p) {
return visitUnknown(node, p);
}
@@ -83,7 +83,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitExportEntry(ExportEntryTree node, P p) {
+ public R visitExportEntry(final ExportEntryTree node, final P p) {
return visitUnknown(node, p);
}
@@ -96,7 +96,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitImportEntry(ImportEntryTree node, P p) {
+ public R visitImportEntry(final ImportEntryTree node, final P p) {
return visitUnknown(node, p);
}
@@ -153,7 +153,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitClassDeclaration(ClassDeclarationTree node, P p) {
+ public R visitClassDeclaration(final ClassDeclarationTree node, final P p) {
return visitUnknown(node, p);
}
@@ -166,7 +166,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitClassExpression(ClassExpressionTree node, P p) {
+ public R visitClassExpression(final ClassExpressionTree node, final P p) {
return visitUnknown(node, p);
}
@@ -247,7 +247,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitForOfLoop(ForOfLoopTree node, P p) {
+ public R visitForOfLoop(final ForOfLoopTree node, final P p) {
return visitUnknown(node, p);
}
@@ -357,21 +357,21 @@
@Override
public R visitProperty(final PropertyTree node, final P r) {
- FunctionExpressionTree getter = node.getGetter();
+ final FunctionExpressionTree getter = node.getGetter();
if (getter != null) {
getter.accept(this, r);
}
- ExpressionTree key = node.getKey();
+ final ExpressionTree key = node.getKey();
if (key != null) {
key.accept(this, r);
}
- FunctionExpressionTree setter = node.getSetter();
+ final FunctionExpressionTree setter = node.getSetter();
if (setter != null) {
setter.accept(this, r);
}
- ExpressionTree value = node.getValue();
+ final ExpressionTree value = node.getValue();
if (value != null) {
value.accept(this, r);
}
@@ -392,7 +392,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitTemplateLiteral(TemplateLiteralTree node, P p) {
+ public R visitTemplateLiteral(final TemplateLiteralTree node, final P p) {
return visitUnknown(node, p);
}
@@ -410,7 +410,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitSpread(SpreadTree node, P p) {
+ public R visitSpread(final SpreadTree node, final P p) {
return visitUnknown(node, p);
}
@@ -495,7 +495,7 @@
* @return the result of {@code visitUnknown}
*/
@Override
- public R visitYield(YieldTree node, P p) {
+ public R visitYield(final YieldTree node, final P p) {
return visitUnknown(node, p);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES6.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES6.java Thu Oct 06 16:27:47 2016 +0200
@@ -66,7 +66,7 @@
* @return value from the visitor
*/
@Override
- public R visitModule(ModuleTree node, P p) {
+ public R visitModule(final ModuleTree node, final P p) {
node.getImportEntries().forEach(e -> visitImportEntry(e, p));
node.getLocalExportEntries().forEach(e -> visitExportEntry(e, p));
node.getIndirectExportEntries().forEach(e -> visitExportEntry(e, p));
@@ -82,7 +82,7 @@
* @return value from the visitor
*/
@Override
- public R visitExportEntry(ExportEntryTree node, P p) {
+ public R visitExportEntry(final ExportEntryTree node, final P p) {
return null;
}
@@ -94,7 +94,7 @@
* @return value from the visitor
*/
@Override
- public R visitImportEntry(ImportEntryTree node, P p) {
+ public R visitImportEntry(final ImportEntryTree node, final P p) {
return null;
}
@@ -106,7 +106,7 @@
* @return value from the visitor
*/
@Override
- public R visitClassDeclaration(ClassDeclarationTree node, P p) {
+ public R visitClassDeclaration(final ClassDeclarationTree node, final P p) {
node.getName().accept(this, p);
final ExpressionTree heritage = node.getClassHeritage();
if (heritage != null) {
@@ -118,7 +118,7 @@
}
final List<? extends PropertyTree> elements = node.getClassElements();
if (elements != null) {
- for (PropertyTree prop : elements) {
+ for (final PropertyTree prop : elements) {
prop.accept(this, p);
}
}
@@ -134,7 +134,7 @@
* @return value from the visitor
*/
@Override
- public R visitClassExpression(ClassExpressionTree node, P p) {
+ public R visitClassExpression(final ClassExpressionTree node, final P p) {
node.getName().accept(this, p);
final ExpressionTree heritage = node.getClassHeritage();
if (heritage != null) {
@@ -146,7 +146,7 @@
}
final List<? extends PropertyTree> elements = node.getClassElements();
if (elements != null) {
- for (PropertyTree prop : elements) {
+ for (final PropertyTree prop : elements) {
prop.accept(this, p);
}
}
@@ -180,7 +180,7 @@
* @return value from the visitor
*/
@Override
- public R visitYield(YieldTree node, P p) {
+ public R visitYield(final YieldTree node, final P p) {
node.getExpression().accept(this, p);
return null;
}
@@ -193,7 +193,7 @@
* @return value from the visitor
*/
@Override
- public R visitSpread(SpreadTree node, P p) {
+ public R visitSpread(final SpreadTree node, final P p) {
node.getExpression().accept(this, p);
return null;
}
@@ -206,9 +206,9 @@
* @return value from the visitor
*/
@Override
- public R visitTemplateLiteral(TemplateLiteralTree node, P p) {
+ public R visitTemplateLiteral(final TemplateLiteralTree node, final P p) {
final List<? extends ExpressionTree> expressions = node.getExpressions();
- for (ExpressionTree expr : expressions) {
+ for (final ExpressionTree expr : expressions) {
expr.accept(this, p);
}
return null;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SwitchTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -33,7 +33,7 @@
private final List<? extends CaseTree> cases;
SwitchTreeImpl(final SwitchNode node,
final ExpressionTree expr,
- List<? extends CaseTree> cases) {
+ final List<? extends CaseTree> cases) {
super(node);
this.expr = expr;
this.cases = cases;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TemplateLiteralTreeImpl.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TemplateLiteralTreeImpl.java Thu Oct 06 16:27:47 2016 +0200
@@ -33,7 +33,7 @@
private final List<? extends ExpressionTree> expressions;
- TemplateLiteralTreeImpl(Expression node, List<? extends ExpressionTree> expressions) {
+ TemplateLiteralTreeImpl(final Expression node, final List<? extends ExpressionTree> expressions) {
super(node);
this.expressions = expressions;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java Thu Oct 06 16:27:47 2016 +0200
@@ -566,7 +566,7 @@
*/
OTHER(null);
- Kind(Class<? extends Tree> intf) {
+ Kind(final Class<? extends Tree> intf) {
associatedInterface = intf;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/UnknownTreeException.java Thu Oct 06 16:27:47 2016 +0200
@@ -52,7 +52,7 @@
* @param t the unknown tree, may be {@code null}
* @param p an additional parameter, may be {@code null}
*/
- public UnknownTreeException(Tree t, Object p) {
+ public UnknownTreeException(final Tree t, final Object p) {
super("Unknown tree: " + t);
this.tree = t;
this.parameter = p;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Thu Oct 06 16:27:47 2016 +0200
@@ -258,7 +258,7 @@
private final int[] continuationEntryPoints;
// Scope object creators needed for for-of and for-in loops
- private Deque<FieldObjectCreator<?>> scopeObjectCreators = new ArrayDeque<>();
+ private final Deque<FieldObjectCreator<?>> scopeObjectCreators = new ArrayDeque<>();
/**
* Constructor.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java Thu Oct 06 16:27:47 2016 +0200
@@ -102,7 +102,7 @@
super(new BlockLexicalContext() {
@Override
protected Block afterSetStatements(final Block block) {
- for(Statement stmt: block.getStatements()) {
+ for(final Statement stmt: block.getStatements()) {
assert !(stmt instanceof SplitNode);
}
return block;
@@ -145,7 +145,7 @@
final FunctionState fnState = getCurrentFunctionState();
final String name = splitNode.getName();
- Block body = splitNode.getBody();
+ final Block body = splitNode.getBody();
final int firstLineNumber = body.getFirstStatementLineNumber();
final long token = body.getToken();
final int finish = body.getFinish();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionList.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionList.java Thu Oct 06 16:27:47 2016 +0200
@@ -71,10 +71,10 @@
}
@Override
- public void toString(StringBuilder sb, boolean printType) {
+ public void toString(final StringBuilder sb, final boolean printType) {
sb.append("(");
boolean first = true;
- for (Expression expression : expressions) {
+ for (final Expression expression : expressions) {
if (first) {
first = false;
} else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TemplateLiteral.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TemplateLiteral.java Thu Oct 06 16:27:47 2016 +0200
@@ -51,7 +51,7 @@
}
@Override
- public Node accept(NodeVisitor<? extends LexicalContext> visitor) {
+ public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
if (visitor.enterTemplateLiteral(this)) {
return visitor.leaveTemplateLiteral(this);
}
@@ -60,8 +60,8 @@
}
@Override
- public void toString(StringBuilder sb, boolean printType) {
- for (Expression expr : exprs) {
+ public void toString(final StringBuilder sb, final boolean printType) {
+ for (final Expression expr : exprs) {
sb.append(expr);
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Thu Oct 06 16:27:47 2016 +0200
@@ -2474,7 +2474,7 @@
}
@Override
- protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
+ protected FindProperty findProperty(final Object key, final boolean deep, final boolean isScope, final ScriptObject start) {
if (lexicalScope != null && isScope) {
final FindProperty find = lexicalScope.findProperty(key, false);
if (find != null) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java Thu Oct 06 16:27:47 2016 +0200
@@ -473,7 +473,7 @@
if (holder instanceof ScriptObject) {
return ((ScriptObject)holder).get(key);
} else if (holder instanceof JSObject) {
- JSObject jsObj = (JSObject)holder;
+ final JSObject jsObj = (JSObject)holder;
if (key instanceof Integer) {
return jsObj.getSlot((Integer)key);
} else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Thu Oct 06 16:27:47 2016 +0200
@@ -408,7 +408,7 @@
/**
* Test if char is a template literal delimiter ('`').
*/
- private static boolean isTemplateDelimiter(char ch) {
+ private static boolean isTemplateDelimiter(final char ch) {
return ch == '`';
}
@@ -1077,7 +1077,7 @@
add(type == TEMPLATE ? TEMPLATE_HEAD : type, stringState.position, stringState.limit);
// scan to RBRACE
- Lexer expressionLexer = new Lexer(this, saveState());
+ final Lexer expressionLexer = new Lexer(this, saveState());
expressionLexer.templateExpressionOpenBraces = 1;
expressionLexer.lexify();
restoreState(expressionLexer.saveState());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Thu Oct 06 16:27:47 2016 +0200
@@ -632,7 +632,7 @@
return getStatement(false);
}
- private Block getStatement(boolean labelledStatement) {
+ private Block getStatement(final boolean labelledStatement) {
if (type == LBRACE) {
return getBlock(true);
}
@@ -746,28 +746,28 @@
return new BinaryNode(op, lhs, rhs);
}
- private boolean isDestructuringLhs(Expression lhs) {
+ private boolean isDestructuringLhs(final Expression lhs) {
if (lhs instanceof ObjectNode || lhs instanceof LiteralNode.ArrayLiteralNode) {
return isES6();
}
return false;
}
- private void verifyDestructuringAssignmentPattern(Expression pattern, String contextString) {
+ private void verifyDestructuringAssignmentPattern(final Expression pattern, final String contextString) {
assert pattern instanceof ObjectNode || pattern instanceof LiteralNode.ArrayLiteralNode;
pattern.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
- public boolean enterLiteralNode(LiteralNode<?> literalNode) {
+ public boolean enterLiteralNode(final LiteralNode<?> literalNode) {
if (literalNode.isArray()) {
boolean restElement = false;
- for (Expression element : literalNode.getElementExpressions()) {
+ for (final Expression element : literalNode.getElementExpressions()) {
if (element != null) {
if (restElement) {
throw error(String.format("Unexpected element after rest element"), element.getToken());
}
if (element.isTokenType(SPREAD_ARRAY)) {
restElement = true;
- Expression lvalue = ((UnaryNode) element).getExpression();
+ final Expression lvalue = ((UnaryNode) element).getExpression();
if (!checkValidLValue(lvalue, contextString)) {
throw error(AbstractParser.message("invalid.lvalue"), lvalue.getToken());
}
@@ -782,12 +782,12 @@
}
@Override
- public boolean enterObjectNode(ObjectNode objectNode) {
+ public boolean enterObjectNode(final ObjectNode objectNode) {
return true;
}
@Override
- public boolean enterPropertyNode(PropertyNode propertyNode) {
+ public boolean enterPropertyNode(final PropertyNode propertyNode) {
if (propertyNode.getValue() != null) {
propertyNode.getValue().accept(this);
return false;
@@ -797,7 +797,7 @@
}
@Override
- public boolean enterIdentNode(IdentNode identNode) {
+ public boolean enterIdentNode(final IdentNode identNode) {
verifyIdent(identNode, contextString);
if (!checkIdentLValue(identNode)) {
referenceError(identNode, null, true);
@@ -807,17 +807,17 @@
}
@Override
- public boolean enterAccessNode(AccessNode accessNode) {
+ public boolean enterAccessNode(final AccessNode accessNode) {
return false;
}
@Override
- public boolean enterIndexNode(IndexNode indexNode) {
+ public boolean enterIndexNode(final IndexNode indexNode) {
return false;
}
@Override
- public boolean enterBinaryNode(BinaryNode binaryNode) {
+ public boolean enterBinaryNode(final BinaryNode binaryNode) {
if (binaryNode.isTokenType(ASSIGN)) {
binaryNode.lhs().accept(this);
// Initializer(rhs) can be any AssignmentExpression
@@ -828,7 +828,7 @@
}
@Override
- public boolean enterUnaryNode(UnaryNode unaryNode) {
+ public boolean enterUnaryNode(final UnaryNode unaryNode) {
if (unaryNode.isTokenType(SPREAD_ARRAY)) {
// rest element
return true;
@@ -838,7 +838,7 @@
}
@Override
- protected boolean enterDefault(Node node) {
+ protected boolean enterDefault(final Node node) {
throw error(String.format("unexpected node in AssignmentPattern: %s", node));
}
});
@@ -1221,13 +1221,13 @@
* class BindingIdentifier[?Yield] ClassTail[?Yield]
* [+Default] class ClassTail[?Yield]
*/
- private ClassNode classDeclaration(boolean isDefault) {
- int classLineNumber = line;
-
- ClassNode classExpression = classExpression(!isDefault);
+ private ClassNode classDeclaration(final boolean isDefault) {
+ final int classLineNumber = line;
+
+ final ClassNode classExpression = classExpression(!isDefault);
if (!isDefault) {
- VarNode classVar = new VarNode(classLineNumber, classExpression.getToken(), classExpression.getIdent().getFinish(), classExpression.getIdent(), classExpression, VarNode.IS_CONST);
+ final VarNode classVar = new VarNode(classLineNumber, classExpression.getToken(), classExpression.getIdent().getFinish(), classExpression.getIdent(), classExpression, VarNode.IS_CONST);
appendStatement(classVar);
}
return classExpression;
@@ -1237,10 +1237,10 @@
* ClassExpression[Yield] :
* class BindingIdentifier[?Yield]opt ClassTail[?Yield]
*/
- private ClassNode classExpression(boolean isStatement) {
+ private ClassNode classExpression(final boolean isStatement) {
assert type == CLASS;
- int classLineNumber = line;
- long classToken = token;
+ final int classLineNumber = line;
+ final long classToken = token;
next();
IdentNode className = null;
@@ -1255,7 +1255,7 @@
private final boolean isStatic;
private final String propertyName;
- private ClassElementKey(boolean isStatic, String propertyName) {
+ private ClassElementKey(final boolean isStatic, final String propertyName) {
this.isStatic = isStatic;
this.propertyName = propertyName;
}
@@ -1270,9 +1270,9 @@
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj instanceof ClassElementKey) {
- ClassElementKey other = (ClassElementKey) obj;
+ final ClassElementKey other = (ClassElementKey) obj;
return this.isStatic == other.isStatic && Objects.equals(this.propertyName, other.propertyName);
}
return false;
@@ -1386,7 +1386,7 @@
}
}
- private PropertyNode createDefaultClassConstructor(int classLineNumber, long classToken, long lastToken, IdentNode className, boolean subclass) {
+ private PropertyNode createDefaultClassConstructor(final int classLineNumber, final long classToken, final long lastToken, final IdentNode className, final boolean subclass) {
final int ctorFinish = finish;
final List<Statement> statements;
final List<IdentNode> parameters;
@@ -1844,7 +1844,7 @@
final Expression expression = expression();
if (expression != null) {
- ExpressionStatement expressionStatement = new ExpressionStatement(expressionLine, expressionToken, finish, expression);
+ final ExpressionStatement expressionStatement = new ExpressionStatement(expressionLine, expressionToken, finish, expression);
appendStatement(expressionStatement);
} else {
expect(null);
@@ -2075,7 +2075,7 @@
private boolean lookaheadIsLetDeclaration(final boolean ofContextualKeyword) {
assert type == LET;
for (int i = 1;; i++) {
- TokenType t = T(k + i);
+ final TokenType t = T(k + i);
switch (t) {
case EOL:
case COMMENT:
@@ -3076,7 +3076,7 @@
*/
private Expression computedPropertyName() {
expect(LBRACKET);
- Expression expression = assignmentExpression(false);
+ final Expression expression = assignmentExpression(false);
expect(RBRACKET);
return expression;
}
@@ -3285,11 +3285,11 @@
return new PropertyFunction(propertyName, function, computed);
}
- private PropertyFunction propertyMethodFunction(Expression key, final long methodToken, final int methodLine, final boolean generator, final int flags, boolean computed) {
+ private PropertyFunction propertyMethodFunction(final Expression key, final long methodToken, final int methodLine, final boolean generator, final int flags, final boolean computed) {
final String methodName = key instanceof PropertyKey ? ((PropertyKey) key).getPropertyName() : getDefaultValidFunctionName(methodLine, false);
final IdentNode methodNameNode = createIdentNode(((Node)key).getToken(), finish, methodName);
- FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
+ final FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
final ParserContextFunctionNode functionNode = createParserContextFunctionNode(methodNameNode, methodToken, functionKind, methodLine, null);
functionNode.setFlag(flags);
if (computed) {
@@ -3548,7 +3548,7 @@
if (isES6()) {
final ParserContextFunctionNode currentFunction = getCurrentNonArrowFunction();
if (currentFunction.isMethod()) {
- long identToken = Token.recast(token, IDENT);
+ final long identToken = Token.recast(token, IDENT);
next();
lhs = createIdentNode(identToken, finish, SUPER.getName());
@@ -3766,7 +3766,7 @@
isAnonymous = true;
}
- FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
+ final FunctionNode.Kind functionKind = generator ? FunctionNode.Kind.GENERATOR : FunctionNode.Kind.NORMAL;
List<IdentNode> parameters = Collections.emptyList();
final ParserContextFunctionNode functionNode = createParserContextFunctionNode(name, functionToken, functionKind, functionLine, parameters);
lc.push(functionNode);
@@ -3870,7 +3870,7 @@
}
}
- private static Block maybeWrapBodyInParameterBlock(Block functionBody, ParserContextBlockNode parameterBlock) {
+ private static Block maybeWrapBodyInParameterBlock(final Block functionBody, final ParserContextBlockNode parameterBlock) {
assert functionBody.isFunctionBody();
if (!parameterBlock.getStatements().isEmpty()) {
parameterBlock.appendStatement(new BlockStatement(functionBody));
@@ -4006,26 +4006,26 @@
}
// default parameter
- Expression initializer = assignmentExpression(false);
-
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final Expression initializer = assignmentExpression(false);
+
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
if (env._parse_only) {
// keep what is seen in source "as is" and save it as parameter expression
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, initializer);
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, initializer);
currentFunction.addParameterExpression(ident, assignment);
} else {
// desugar to: param = (param === undefined) ? initializer : param;
// possible alternative: if (param === undefined) param = initializer;
- BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
- TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, value);
+ final BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
+ final TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, value);
lc.getFunctionBody(currentFunction).appendStatement(new ExpressionStatement(paramLine, assignment.getToken(), assignment.getFinish(), assignment));
}
}
}
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
currentFunction.addParameterBinding(ident);
if (ident.isRestParameter() || ident.isDefaultParameter()) {
@@ -4044,22 +4044,22 @@
ident = ident.setIsDefaultParameter();
// binding pattern with initializer. desugar to: (param === undefined) ? initializer : param
- Expression initializer = assignmentExpression(false);
+ final Expression initializer = assignmentExpression(false);
if (env._parse_only) {
// we don't want the synthetic identifier in parse only mode
value = initializer;
} else {
// TODO initializer must not contain yield expression if yield=true (i.e. this is generator function's parameter list)
- BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
+ final BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
}
}
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
// destructuring assignment
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), pattern, value);
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), pattern, value);
if (env._parse_only) {
// in parse-only mode, represent source tree "as is"
if (ident.isDefaultParameter()) {
@@ -4081,10 +4081,10 @@
private void verifyDestructuringParameterBindingPattern(final Expression pattern, final long paramToken, final int paramLine, final String contextString) {
verifyDestructuringBindingPattern(pattern, new Consumer<IdentNode>() {
- public void accept(IdentNode identNode) {
+ public void accept(final IdentNode identNode) {
verifyIdent(identNode, contextString);
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
// declare function-scope variables for destructuring bindings
if (!env._parse_only) {
@@ -4398,7 +4398,7 @@
break;
}
- Expression expression = leftHandSideExpression();
+ final Expression expression = leftHandSideExpression();
if (last != EOL) {
switch (type) {
@@ -4549,7 +4549,7 @@
private Expression expression(final boolean noIn) {
Expression assignmentExpression = assignmentExpression(noIn);
while (type == COMMARIGHT) {
- long commaToken = token;
+ final long commaToken = token;
next();
boolean rhsRestParameter = false;
@@ -4707,7 +4707,7 @@
/**
* Is type one of {@code = *= /= %= += -= <<= >>= >>>= &= ^= |=}?
*/
- private static boolean isAssignmentOperator(TokenType type) {
+ private static boolean isAssignmentOperator(final TokenType type) {
switch (type) {
case ASSIGN:
case ASSIGN_ADD:
@@ -4729,7 +4729,7 @@
/**
* ConditionalExpression.
*/
- private Expression conditionalExpression(boolean noIn) {
+ private Expression conditionalExpression(final boolean noIn) {
return expression(TERNARY.getPrecedence(), noIn);
}
@@ -4752,7 +4752,7 @@
lc.push(functionNode);
try {
- ParserContextBlockNode parameterBlock = newBlock();
+ final ParserContextBlockNode parameterBlock = newBlock();
final List<IdentNode> parameters;
try {
parameters = convertArrowFunctionParameterList(paramListExpr, functionLine);
@@ -4829,12 +4829,12 @@
return parameters;
}
- private IdentNode verifyArrowParameter(Expression param, int index, int paramLine) {
+ private IdentNode verifyArrowParameter(final Expression param, final int index, final int paramLine) {
final String contextString = "function parameter";
if (param instanceof IdentNode) {
- IdentNode ident = (IdentNode)param;
+ final IdentNode ident = (IdentNode)param;
verifyStrictIdent(ident, contextString);
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
currentFunction.addParameterBinding(ident);
}
@@ -4842,21 +4842,21 @@
}
if (param.isTokenType(ASSIGN)) {
- Expression lhs = ((BinaryNode) param).lhs();
- long paramToken = lhs.getToken();
- Expression initializer = ((BinaryNode) param).rhs();
+ final Expression lhs = ((BinaryNode) param).lhs();
+ final long paramToken = lhs.getToken();
+ final Expression initializer = ((BinaryNode) param).rhs();
if (lhs instanceof IdentNode) {
// default parameter
- IdentNode ident = (IdentNode) lhs;
-
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final IdentNode ident = (IdentNode) lhs;
+
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
if (env._parse_only) {
currentFunction.addParameterExpression(ident, param);
} else {
- BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
- TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, value);
+ final BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
+ final TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), ident, value);
lc.getFunctionBody(currentFunction).appendStatement(new ExpressionStatement(paramLine, assignment.getToken(), assignment.getFinish(), assignment));
}
@@ -4867,17 +4867,17 @@
} else if (isDestructuringLhs(lhs)) {
// binding pattern with initializer
// Introduce synthetic temporary parameter to capture the object to be destructured.
- IdentNode ident = createIdentNode(paramToken, param.getFinish(), String.format("arguments[%d]", index)).setIsDestructuredParameter().setIsDefaultParameter();
+ final IdentNode ident = createIdentNode(paramToken, param.getFinish(), String.format("arguments[%d]", index)).setIsDestructuredParameter().setIsDefaultParameter();
verifyDestructuringParameterBindingPattern(param, paramToken, paramLine, contextString);
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
if (env._parse_only) {
currentFunction.addParameterExpression(ident, param);
} else {
- BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
- TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), param, value);
+ final BinaryNode test = new BinaryNode(Token.recast(paramToken, EQ_STRICT), ident, newUndefinedLiteral(paramToken, finish));
+ final TernaryNode value = new TernaryNode(Token.recast(paramToken, TERNARY), test, new JoinPredecessorExpression(initializer), new JoinPredecessorExpression(ident));
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), param, value);
lc.getFunctionBody(currentFunction).appendStatement(new ExpressionStatement(paramLine, assignment.getToken(), assignment.getFinish(), assignment));
}
}
@@ -4885,18 +4885,18 @@
}
} else if (isDestructuringLhs(param)) {
// binding pattern
- long paramToken = param.getToken();
+ final long paramToken = param.getToken();
// Introduce synthetic temporary parameter to capture the object to be destructured.
- IdentNode ident = createIdentNode(paramToken, param.getFinish(), String.format("arguments[%d]", index)).setIsDestructuredParameter();
+ final IdentNode ident = createIdentNode(paramToken, param.getFinish(), String.format("arguments[%d]", index)).setIsDestructuredParameter();
verifyDestructuringParameterBindingPattern(param, paramToken, paramLine, contextString);
- ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
+ final ParserContextFunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction != null) {
if (env._parse_only) {
currentFunction.addParameterExpression(ident, param);
} else {
- BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), param, ident);
+ final BinaryNode assignment = new BinaryNode(Token.recast(paramToken, ASSIGN), param, ident);
lc.getFunctionBody(currentFunction).appendStatement(new ExpressionStatement(paramLine, assignment.getToken(), assignment.getFinish(), assignment));
}
}
@@ -4913,7 +4913,7 @@
return true;
}
for (int i = k - 1; i >= 0; i--) {
- TokenType t = T(i);
+ final TokenType t = T(i);
switch (t) {
case RPAREN:
case IDENT:
@@ -4941,7 +4941,7 @@
// find IDENT, RPAREN, ARROW, in that order, skipping over EOL (where allowed) and COMMENT
int i = 1;
for (;;) {
- TokenType t = T(k + i++);
+ final TokenType t = T(k + i++);
if (t == IDENT) {
break;
} else if (t == EOL || t == COMMENT) {
@@ -4951,7 +4951,7 @@
}
}
for (;;) {
- TokenType t = T(k + i++);
+ final TokenType t = T(k + i++);
if (t == RPAREN) {
break;
} else if (t == EOL || t == COMMENT) {
@@ -4961,7 +4961,7 @@
}
}
for (;;) {
- TokenType t = T(k + i++);
+ final TokenType t = T(k + i++);
if (t == ARROW) {
break;
} else if (t == COMMENT) {
@@ -5008,7 +5008,7 @@
}
if (env._parse_only) {
- List<Expression> exprs = new ArrayList<>();
+ final List<Expression> exprs = new ArrayList<>();
exprs.add(literal);
TokenType lastLiteralType;
do {
@@ -5096,12 +5096,12 @@
* ModuleItemList
*/
private FunctionNode module(final String moduleName) {
- boolean oldStrictMode = isStrictMode;
+ final boolean oldStrictMode = isStrictMode;
try {
isStrictMode = true; // Module code is always strict mode code. (ES6 10.2.1)
// Make a pseudo-token for the script holding its start and length.
- int functionStart = Math.min(Token.descPosition(Token.withDelimiter(token)), finish);
+ final int functionStart = Math.min(Token.descPosition(Token.withDelimiter(token)), finish);
final long functionToken = Token.toDesc(FUNCTION, functionStart, source.getLength() - functionStart);
final int functionLine = line;
@@ -5214,7 +5214,7 @@
} else if (isBindingIdentifier()) {
// ImportedDefaultBinding
final IdentNode importedDefaultBinding = bindingIdentifier("ImportedBinding");
- Module.ImportEntry defaultImport = Module.ImportEntry.importSpecifier(importedDefaultBinding, startPosition, finish);
+ final Module.ImportEntry defaultImport = Module.ImportEntry.importSpecifier(importedDefaultBinding, startPosition, finish);
if (type == COMMARIGHT) {
next();
@@ -5279,7 +5279,7 @@
private List<Module.ImportEntry> namedImports(final int startPosition) {
assert type == LBRACE;
next();
- List<Module.ImportEntry> importEntries = new ArrayList<>();
+ final List<Module.ImportEntry> importEntries = new ArrayList<>();
while (type != RBRACE) {
final boolean bindingIdentifier = isBindingIdentifier();
final long nameToken = token;
@@ -5354,11 +5354,11 @@
if (type == IDENT && "from".equals(getValue())) {
final IdentNode moduleRequest = fromClause();
module.addModuleRequest(moduleRequest);
- for (Module.ExportEntry exportEntry : exportEntries) {
+ for (final Module.ExportEntry exportEntry : exportEntries) {
module.addIndirectExportEntry(exportEntry.withFrom(moduleRequest, finish));
}
} else {
- for (Module.ExportEntry exportEntry : exportEntries) {
+ for (final Module.ExportEntry exportEntry : exportEntries) {
module.addLocalExportEntry(exportEntry);
}
}
@@ -5445,7 +5445,7 @@
private List<Module.ExportEntry> exportClause(final int startPosition) {
assert type == LBRACE;
next();
- List<Module.ExportEntry> exports = new ArrayList<>();
+ final List<Module.ExportEntry> exports = new ArrayList<>();
while (type != RBRACE) {
final IdentNode localName = getIdentifierName();
if (type == IDENT && "as".equals(getValue())) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextFunctionNode.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextFunctionNode.java Thu Oct 06 16:27:47 2016 +0200
@@ -169,7 +169,7 @@
return parameters;
}
- void setParameters(List<IdentNode> parameters) {
+ void setParameters(final List<IdentNode> parameters) {
this.parameters = parameters;
}
@@ -182,7 +182,7 @@
return parameterExpressions;
}
- void addParameterExpression(IdentNode ident, Expression node) {
+ void addParameterExpression(final IdentNode ident, final Expression node) {
if (parameterExpressions == null) {
parameterExpressions = new HashMap<>();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextModuleNode.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextModuleNode.java Thu Oct 06 16:27:47 2016 +0200
@@ -41,11 +41,11 @@
/** Module name. */
private final String name;
- private List<String> requestedModules = new ArrayList<>();
- private List<ImportEntry> importEntries = new ArrayList<>();
- private List<ExportEntry> localExportEntries = new ArrayList<>();
- private List<ExportEntry> indirectExportEntries = new ArrayList<>();
- private List<ExportEntry> starExportEntries = new ArrayList<>();
+ private final List<String> requestedModules = new ArrayList<>();
+ private final List<ImportEntry> importEntries = new ArrayList<>();
+ private final List<ExportEntry> localExportEntries = new ArrayList<>();
+ private final List<ExportEntry> indirectExportEntries = new ArrayList<>();
+ private final List<ExportEntry> starExportEntries = new ArrayList<>();
/**
* Constructor.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java Thu Oct 06 16:27:47 2016 +0200
@@ -141,7 +141,7 @@
final private WeakReference<ScriptObject> prototype;
final private WeakReference<PropertyMap> prototypeMap;
- private PropertyMap allocatorMap;
+ private final PropertyMap allocatorMap;
AllocatorMap(final ScriptObject prototype, final PropertyMap protoMap, final PropertyMap allocMap) {
this.prototype = new WeakReference<>(prototype);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CommandExecutor.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CommandExecutor.java Thu Oct 06 16:27:47 2016 +0200
@@ -148,14 +148,14 @@
boolean check(String token, final Iterator<String> iterator, final String cwd) {
// Iterate through redirect prefixes to file a match.
for (int i = 0; i < redirectPrefixes.length; i++) {
- String prefix = redirectPrefixes[i];
+ final String prefix = redirectPrefixes[i];
// If a match is found.
if (token.startsWith(prefix)) {
// Indicate we have at least one redirect (efficiency.)
hasRedirects = true;
// Map prefix to RedirectType.
- RedirectType redirect = redirects[i];
+ final RedirectType redirect = redirects[i];
// Strip prefix from token
token = token.substring(prefix.length());
@@ -223,8 +223,8 @@
// Only if there was redirects (saves new structure in ProcessBuilder.)
if (hasRedirects) {
// If output and error are the same file then merge.
- File outputFile = outputRedirect.file();
- File errorFile = errorRedirect.file();
+ final File outputFile = outputRedirect.file();
+ final File errorFile = errorRedirect.file();
if (outputFile != null && outputFile.equals(errorFile)) {
mergeError = true;
@@ -274,26 +274,26 @@
public void run() {
try {
// Buffer for copying.
- byte[] b = new byte[BUFFER_SIZE];
+ final byte[] b = new byte[BUFFER_SIZE];
// Read from the InputStream until EOF.
int read;
while (-1 < (read = input.read(b, 0, b.length))) {
// Write available date to OutputStream.
output.write(b, 0, read);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// Assume the worst.
throw new RuntimeException("Broken pipe", e);
} finally {
// Make sure the streams are closed.
try {
input.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
// Don't care.
}
try {
output.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
// Don't care.
}
}
@@ -363,7 +363,7 @@
private long envVarLongValue(final String key) {
try {
return Long.parseLong(envVarValue(key, "0"));
- } catch (NumberFormatException ex) {
+ } catch (final NumberFormatException ex) {
return 0L;
}
}
@@ -478,7 +478,7 @@
// iterate through all tokens.
final Iterator<String> iterator = tokens.iterator();
while (iterator.hasNext()) {
- String token = iterator.next();
+ final String token = iterator.next();
// Check if is a redirect.
if (redirectInfo.check(token, iterator, cwd)) {
@@ -551,7 +551,7 @@
* @param tokens tokens of the command
* @param isPiped true if the output of this command should be piped to the next
*/
- private void command(final List<String> tokens, boolean isPiped) {
+ private void command(final List<String> tokens, final boolean isPiped) {
// Test to see if we should echo the command to output.
if (envVarBooleanValue("JJS_ECHO")) {
System.out.println(String.join(" ", tokens));
@@ -584,7 +584,7 @@
boolean inputIsPipe = firstProcessBuilder.redirectInput() == Redirect.PIPE;
boolean outputIsPipe = lastProcessBuilder.redirectOutput() == Redirect.PIPE;
boolean errorIsPipe = lastProcessBuilder.redirectError() == Redirect.PIPE;
- boolean inheritIO = envVarBooleanValue("JJS_INHERIT_IO");
+ final boolean inheritIO = envVarBooleanValue("JJS_INHERIT_IO");
// If not redirected and inputStream is current processes' input.
if (inputIsPipe && (inheritIO || inputStream == System.in)) {
@@ -609,10 +609,10 @@
// Start the processes.
final List<Process> processes = new ArrayList<>();
- for (ProcessBuilder pb : processBuilders) {
+ for (final ProcessBuilder pb : processBuilders) {
try {
processes.add(pb.start());
- } catch (IOException ex) {
+ } catch (final IOException ex) {
reportError("unknown.command", String.join(" ", pb.command()));
return;
}
@@ -701,7 +701,7 @@
// Accumulate the output and error streams.
outputString += byteOutputStream != null ? byteOutputStream.toString() : "";
errorString += byteErrorStream != null ? byteErrorStream.toString() : "";
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
// Kill any living processes.
processes.stream().forEach(p -> {
if (p.isAlive()) {
@@ -829,7 +829,7 @@
final Iterator<String> iterator = tokens.iterator();
while (iterator.hasNext() && exitCode == EXIT_SUCCESS) {
// Next word token.
- String token = iterator.next();
+ final String token = iterator.next();
if (token == null) {
continue;
@@ -876,23 +876,23 @@
return exitCode;
}
- void setEnvironment(Map<String, String> environment) {
+ void setEnvironment(final Map<String, String> environment) {
this.environment = environment;
}
- void setInputStream(InputStream inputStream) {
+ void setInputStream(final InputStream inputStream) {
this.inputStream = inputStream;
}
- void setInputString(String inputString) {
+ void setInputString(final String inputString) {
this.inputString = inputString;
}
- void setOutputStream(OutputStream outputStream) {
+ void setOutputStream(final OutputStream outputStream) {
this.outputStream = outputStream;
}
- void setErrorStream(OutputStream errorStream) {
+ void setErrorStream(final OutputStream errorStream) {
this.errorStream = errorStream;
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Thu Oct 06 16:27:47 2016 +0200
@@ -1339,7 +1339,7 @@
final ModuleFinder finder = new ModuleFinder() {
@Override
- public Optional<ModuleReference> find(String name) {
+ public Optional<ModuleReference> find(final String name) {
if (name.equals(mn)) {
return Optional.of(mref);
} else {
@@ -1387,7 +1387,7 @@
ClassLoader loader = null;
try {
loader = clazz.getClassLoader();
- } catch (SecurityException ignored) {
+ } catch (final SecurityException ignored) {
// This could fail because of anonymous classes being used.
// Accessing loader of anonymous class fails (for extension
// loader class too?). In any case, for us fetching Context
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java Thu Oct 06 16:27:47 2016 +0200
@@ -87,7 +87,7 @@
@Override
String getDocumentation() {
- String doc = docKey != null?
+ final String doc = docKey != null?
FunctionDocumentation.getDoc(docKey) : null;
return doc != null? doc : super.getDocumentation();
}
@@ -109,7 +109,7 @@
}
@Override
- CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection<CompiledFunction> forbidden, boolean linkLogicOkay) {
+ CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection<CompiledFunction> forbidden, final boolean linkLogicOkay) {
assert isValidCallSite(callSiteType) : callSiteType;
CompiledFunction best = null;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONListAdapter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONListAdapter.java Thu Oct 06 16:27:47 2016 +0200
@@ -155,7 +155,7 @@
}
@Override
- public Object getDefaultValue(Class<?> hint) throws UnsupportedOperationException {
+ public Object getDefaultValue(final Class<?> hint) throws UnsupportedOperationException {
return obj.getDefaultValue(hint);
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Thu Oct 06 16:27:47 2016 +0200
@@ -221,7 +221,7 @@
final String res = "/"+ MODULE_MANIPULATOR_NAME.replace('.', '/') + ".class";
try (InputStream in = NashornLoader.class.getResourceAsStream(res)) {
return in.readAllBytes();
- } catch (IOException exp) {
+ } catch (final IOException exp) {
throw new UncheckedIOException(exp);
}
};
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Thu Oct 06 16:27:47 2016 +0200
@@ -95,7 +95,7 @@
}
@Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
+ protected Class<?> findClass(final String name) throws ClassNotFoundException {
final ClassLoader appLoader = context.getAppLoader();
/*
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java Thu Oct 06 16:27:47 2016 +0200
@@ -149,7 +149,7 @@
String inputString = null;
if (arg0 instanceof NativeArray) {
- String[] array = (String[])JSType.toJavaArray(arg0, String.class);
+ final String[] array = (String[])JSType.toJavaArray(arg0, String.class);
tokens = new ArrayList<>();
tokens.addAll(Arrays.asList(array));
} else {
@@ -206,7 +206,7 @@
final String outString = executor.getOutputString();
final String errString = executor.getErrorString();
- int exitCode = executor.getExitCode();
+ final int exitCode = executor.getExitCode();
// Set globals for secondary results.
global.set(OUT_NAME, outString, 0);
@@ -222,7 +222,7 @@
private static Function<String, String> readLineHelper;
- public static void setReadLineHelper(Function<String, String> func) {
+ public static void setReadLineHelper(final Function<String, String> func) {
readLineHelper = Objects.requireNonNull(func);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Thu Oct 06 16:27:47 2016 +0200
@@ -183,7 +183,7 @@
* @return FindPropertyData or null if not found.
*/
@Override
- protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
+ protected FindProperty findProperty(final Object key, final boolean deep, final boolean isScope, final ScriptObject start) {
// We call findProperty on 'expression' with 'expression' itself as start parameter.
// This way in ScriptObject.setObject we can tell the property is from a 'with' expression
// (as opposed from another non-scope object in the proto chain such as Object.prototype).
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/doubleconv/Bignum.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/doubleconv/Bignum.java Thu Oct 06 16:27:47 2016 +0200
@@ -76,7 +76,7 @@
// grow. There are no checks if the stack-allocated space is sufficient.
static final int kBigitCapacity = kMaxSignificantBits / kBigitSize;
- private int[] bigits_ = new int[kBigitCapacity];
+ private final int[] bigits_ = new int[kBigitCapacity];
// A vector backed by bigits_buffer_. This way accesses to the array are
// checked for out-of-bounds errors.
// Vector<int> bigits_;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Thu Oct 06 16:27:47 2016 +0200
@@ -214,7 +214,7 @@
// new target uses a more precise 'self' type than Object.class. We need to
// convert the filter type. Note that the profileEntry method returns "self"
// argument "as is" and so the cast introduced will succeed for any type.
- MethodType selfFilterType = MethodType.methodType(newSelfType, newSelfType);
+ final MethodType selfFilterType = MethodType.methodType(newSelfType, newSelfType);
selfFilter = selfFilter.asType(selfFilterType);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NameCodec.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NameCodec.java Thu Oct 06 16:27:47 2016 +0200
@@ -283,7 +283,7 @@
* @return the mangled form of the symbolic name.
*/
public static String encode(final String name) {
- String bn = mangle(name);
+ final String bn = mangle(name);
assert((Object)bn == name || looksMangled(bn)) : bn;
assert(name.equals(decode(bn))) : name;
return bn;
@@ -303,11 +303,11 @@
return sn;
}
- private static boolean looksMangled(String s) {
+ private static boolean looksMangled(final String s) {
return s.charAt(0) == ESCAPE_C;
}
- private static String mangle(String s) {
+ private static String mangle(final String s) {
if (s.length() == 0)
return NULL_ESCAPE;
@@ -315,12 +315,12 @@
StringBuilder sb = null;
for (int i = 0, slen = s.length(); i < slen; i++) {
- char c = s.charAt(i);
+ final char c = s.charAt(i);
boolean needEscape = false;
if (c == ESCAPE_C) {
if (i+1 < slen) {
- char c1 = s.charAt(i+1);
+ final char c1 = s.charAt(i+1);
if ((i == 0 && c1 == NULL_ESCAPE_C)
|| c1 != originalOfReplacement(c1)) {
// an accidental escape
@@ -356,7 +356,7 @@
return s;
}
- private static String demangle(String s) {
+ private static String demangle(final String s) {
// build this lazily, when we first meet an escape:
StringBuilder sb = null;
@@ -369,8 +369,8 @@
if (c == ESCAPE_C && i+1 < slen) {
// might be an escape sequence
- char rc = s.charAt(i+1);
- char oc = originalOfReplacement(rc);
+ final char rc = s.charAt(i+1);
+ final char oc = originalOfReplacement(rc);
if (oc != rc) {
// build sb if this is the first escape
if (sb == null) {
@@ -398,34 +398,34 @@
private static final long[] SPECIAL_BITMAP = new long[2]; // 128 bits
static {
- String SPECIAL = DANGEROUS_CHARS + REPLACEMENT_CHARS;
- for (char c : SPECIAL.toCharArray()) {
+ final String SPECIAL = DANGEROUS_CHARS + REPLACEMENT_CHARS;
+ for (final char c : SPECIAL.toCharArray()) {
SPECIAL_BITMAP[c >>> 6] |= 1L << c;
}
}
- private static boolean isSpecial(char c) {
+ private static boolean isSpecial(final char c) {
if ((c >>> 6) < SPECIAL_BITMAP.length)
return ((SPECIAL_BITMAP[c >>> 6] >> c) & 1) != 0;
else
return false;
}
- private static char replacementOf(char c) {
+ private static char replacementOf(final char c) {
if (!isSpecial(c)) return c;
- int i = DANGEROUS_CHARS.indexOf(c);
+ final int i = DANGEROUS_CHARS.indexOf(c);
if (i < 0) return c;
return REPLACEMENT_CHARS.charAt(i);
}
- private static char originalOfReplacement(char c) {
+ private static char originalOfReplacement(final char c) {
if (!isSpecial(c)) return c;
- int i = REPLACEMENT_CHARS.indexOf(c);
+ final int i = REPLACEMENT_CHARS.indexOf(c);
if (i < 0) return c;
return DANGEROUS_CHARS.charAt(i);
}
- private static boolean isDangerous(char c) {
+ private static boolean isDangerous(final char c) {
if (!isSpecial(c)) return false;
return (DANGEROUS_CHARS.indexOf(c) >= DANGEROUS_CHAR_FIRST_INDEX);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Thu Oct 06 16:27:47 2016 +0200
@@ -292,7 +292,7 @@
String l = "";
try (final BufferedReader r = Files.newBufferedReader(p)) {
l = r.readLine();
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
// ignore
}
if (l.startsWith("#!")) {
--- a/nashorn/test/src/jdk/dynalink/linker/support/test/LookupTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/linker/support/test/LookupTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -59,7 +59,7 @@
private static void privateStaticFunc() {}
@SuppressWarnings("unused")
- private int myIntField = 0;
+ private final int myIntField = 0;
@SuppressWarnings("unused")
@DataProvider
@@ -72,26 +72,26 @@
@Test(dataProvider = "flags")
public void unreflectTest(final boolean publicLookup) throws NoSuchMethodException {
- MethodHandle mh = Lookup.unreflect(getLookup(publicLookup), LookupTest.class.getMethod("unreflectTest", Boolean.TYPE));
+ final MethodHandle mh = Lookup.unreflect(getLookup(publicLookup), LookupTest.class.getMethod("unreflectTest", Boolean.TYPE));
Assert.assertNotNull(mh);
}
@Test
public void unreflectTest2() throws NoSuchMethodException {
- MethodHandle mh = Lookup.PUBLIC.unreflect(LookupTest.class.getMethod("unreflectTest", Boolean.TYPE));
+ final MethodHandle mh = Lookup.PUBLIC.unreflect(LookupTest.class.getMethod("unreflectTest", Boolean.TYPE));
Assert.assertNotNull(mh);
}
@Test(dataProvider = "flags")
public void unreflectNegativeTest(final boolean publicLookup) throws NoSuchMethodException {
try {
- MethodHandle mh = Lookup.unreflect(getLookup(publicLookup),
+ final MethodHandle mh = Lookup.unreflect(getLookup(publicLookup),
LookupTest.class.getDeclaredMethod("privateFunc"));
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -102,33 +102,33 @@
try {
Lookup.PUBLIC.unreflect(LookupTest.class.getDeclaredMethod("privateFunc"));
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@Test(dataProvider = "flags")
public void unreflectConstructorTest(final boolean publicLookup) throws NoSuchMethodException {
- MethodHandle mh = Lookup.unreflectConstructor(getLookup(publicLookup), LookupTest.class.getConstructor());
+ final MethodHandle mh = Lookup.unreflectConstructor(getLookup(publicLookup), LookupTest.class.getConstructor());
Assert.assertNotNull(mh);
}
@Test
public void unreflectConstructorTest2() throws NoSuchMethodException {
- MethodHandle mh = Lookup.PUBLIC.unreflectConstructor(LookupTest.class.getConstructor());
+ final MethodHandle mh = Lookup.PUBLIC.unreflectConstructor(LookupTest.class.getConstructor());
Assert.assertNotNull(mh);
}
@Test(dataProvider = "flags")
public void unreflectConstructorNegativeTest(final boolean publicLookup) throws NoSuchMethodException {
try {
- MethodHandle mh = Lookup.unreflectConstructor(getLookup(publicLookup),
+ final MethodHandle mh = Lookup.unreflectConstructor(getLookup(publicLookup),
LookupTest.class.getDeclaredConstructor(Integer.TYPE));
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -140,7 +140,7 @@
Lookup.PUBLIC.unreflectConstructor(
LookupTest.class.getDeclaredConstructor(Integer.TYPE));
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@@ -148,13 +148,13 @@
@Test(dataProvider = "flags")
public void findOwnStaticTest(final boolean publicLookup) {
try {
- MethodHandle mh = Lookup.findOwnStatic(getLookup(publicLookup), "getLookup",
+ final MethodHandle mh = Lookup.findOwnStatic(getLookup(publicLookup), "getLookup",
MethodHandles.Lookup.class, Boolean.TYPE);
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -166,7 +166,7 @@
Lookup.PUBLIC.findStatic(LookupTest.class, "getLookup",
MethodType.methodType(MethodHandles.Lookup.class, Boolean.TYPE));
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@@ -174,12 +174,12 @@
@Test(dataProvider = "flags")
public void findOwnSepcialTest(final boolean publicLookup) {
try {
- MethodHandle mh = Lookup.findOwnSpecial(getLookup(publicLookup), "privateFunc", Void.TYPE);
+ final MethodHandle mh = Lookup.findOwnSpecial(getLookup(publicLookup), "privateFunc", Void.TYPE);
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -190,7 +190,7 @@
try {
Lookup.PUBLIC.findOwnSpecial("privateFunc", Void.TYPE);
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@@ -198,12 +198,12 @@
@Test(dataProvider = "flags")
public void findGetterTest(final boolean publicLookup) {
try {
- MethodHandle mh = new Lookup(getLookup(publicLookup)).findGetter(LookupTest.class, "myIntField", Integer.TYPE);
+ final MethodHandle mh = new Lookup(getLookup(publicLookup)).findGetter(LookupTest.class, "myIntField", Integer.TYPE);
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -214,7 +214,7 @@
try {
Lookup.PUBLIC.findGetter(LookupTest.class, "myIntField", Integer.TYPE);
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@@ -222,13 +222,13 @@
@Test(dataProvider = "flags")
public void findVirtualTest(final boolean publicLookup) {
try {
- MethodHandle mh = new Lookup(getLookup(publicLookup)).findVirtual(LookupTest.class, "protectedFunc",
+ final MethodHandle mh = new Lookup(getLookup(publicLookup)).findVirtual(LookupTest.class, "protectedFunc",
MethodType.methodType(Void.TYPE));
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -240,7 +240,7 @@
Lookup.PUBLIC.findVirtual(LookupTest.class, "protectedFunc",
MethodType.methodType(Void.TYPE));
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
@@ -248,13 +248,13 @@
@Test(dataProvider = "flags")
public void findStaticTest(final boolean publicLookup) {
try {
- MethodHandle mh = new Lookup(getLookup(publicLookup)).findStatic(LookupTest.class, "privateStaticFunc",
+ final MethodHandle mh = new Lookup(getLookup(publicLookup)).findStatic(LookupTest.class, "privateStaticFunc",
MethodType.methodType(Void.TYPE));
if (publicLookup) {
throw new RuntimeException("should have thrown Error");
}
Assert.assertNotNull(mh);
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(publicLookup);
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
@@ -266,7 +266,7 @@
Lookup.PUBLIC.findStatic(LookupTest.class, "privateStaticFunc",
MethodType.methodType(Void.TYPE));
throw new RuntimeException("should have thrown Error");
- } catch (Error err) {
+ } catch (final Error err) {
Assert.assertTrue(err instanceof NoSuchMethodError || err instanceof IllegalAccessError);
}
}
--- a/nashorn/test/src/jdk/dynalink/test/DynamicLinkerFactoryTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/test/DynamicLinkerFactoryTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -35,15 +35,15 @@
import jdk.dynalink.CallSiteDescriptor;
import jdk.dynalink.DynamicLinker;
import jdk.dynalink.DynamicLinkerFactory;
+import jdk.dynalink.NamedOperation;
import jdk.dynalink.NoSuchDynamicMethodException;
-import jdk.dynalink.NamedOperation;
import jdk.dynalink.Operation;
import jdk.dynalink.StandardOperation;
+import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.GuardingDynamicLinker;
import jdk.dynalink.linker.LinkRequest;
import jdk.dynalink.linker.LinkerServices;
import jdk.dynalink.support.SimpleRelinkableCallSite;
-import jdk.dynalink.linker.GuardedInvocation;
import jdk.nashorn.api.scripting.AbstractJSObject;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -80,7 +80,7 @@
final Operation myOperation = new Operation() {
};
final boolean[] reachedFallback = { false };
- factory.setFallbackLinkers((GuardingDynamicLinker) (LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ factory.setFallbackLinkers((GuardingDynamicLinker) (final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
Assert.assertEquals(linkRequest.getCallSiteDescriptor().getOperation(), myOperation);
reachedFallback[0] = true;
return null;
@@ -95,10 +95,10 @@
Assert.assertFalse(reachedFallback[0]);
try {
cs.getTarget().invoke();
- } catch (NoSuchDynamicMethodException nsdm) {
+ } catch (final NoSuchDynamicMethodException nsdm) {
// we do expect NoSuchDynamicMethod!
// because our dummy fallback linker returns null!
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException("should not reach here with: " + th);
}
@@ -112,7 +112,7 @@
final Operation myOperation = new Operation() {
};
final boolean[] reachedProrityLinker = { false };
- factory.setPrioritizedLinker((GuardingDynamicLinker) (LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ factory.setPrioritizedLinker((GuardingDynamicLinker) (final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
Assert.assertEquals(linkRequest.getCallSiteDescriptor().getOperation(), myOperation);
reachedProrityLinker[0] = true;
return null;
@@ -127,10 +127,10 @@
Assert.assertFalse(reachedProrityLinker[0]);
try {
cs.getTarget().invoke();
- } catch (NoSuchDynamicMethodException nsdm) {
+ } catch (final NoSuchDynamicMethodException nsdm) {
// we do expect NoSuchDynamicMethod!
// because our dummy priority linker returns null!
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException("should not reach here with: " + th);
}
@@ -144,12 +144,12 @@
final Operation myOperation = new Operation() {
};
final int[] linkerReachCounter = { 0 };
- factory.setPrioritizedLinker((GuardingDynamicLinker) (LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ factory.setPrioritizedLinker((GuardingDynamicLinker) (final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
Assert.assertEquals(linkRequest.getCallSiteDescriptor().getOperation(), myOperation);
linkerReachCounter[0]++;
return null;
});
- factory.setFallbackLinkers((GuardingDynamicLinker) (LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ factory.setFallbackLinkers((GuardingDynamicLinker) (final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
Assert.assertEquals(linkRequest.getCallSiteDescriptor().getOperation(), myOperation);
Assert.assertEquals(linkerReachCounter[0], 1);
linkerReachCounter[0]++;
@@ -166,9 +166,9 @@
try {
cs.getTarget().invoke();
- } catch (NoSuchDynamicMethodException nsdm) {
+ } catch (final NoSuchDynamicMethodException nsdm) {
// we do expect NoSuchDynamicMethod!
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException("should not reach here with: " + th);
}
@@ -180,7 +180,7 @@
final DynamicLinkerFactory factory = newDynamicLinkerFactory(true);
final boolean[] reachedPrelinkTransformer = { false };
- factory.setPrelinkTransformer((GuardedInvocation inv, LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ factory.setPrelinkTransformer((final GuardedInvocation inv, final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
reachedPrelinkTransformer[0] = true;
// just identity transformer!
return inv;
@@ -200,7 +200,7 @@
final DynamicLinkerFactory factory = newDynamicLinkerFactory(true);
final boolean[] reachedInternalObjectsFilter = { false };
- factory.setInternalObjectsFilter((MethodHandle mh) -> {
+ factory.setInternalObjectsFilter((final MethodHandle mh) -> {
reachedInternalObjectsFilter[0] = true;
return mh;
});
@@ -249,10 +249,10 @@
try {
cs.getTarget().invoke(new Object());
- } catch (ReachedAutoLoadedDynamicLinkerException e) {
+ } catch (final ReachedAutoLoadedDynamicLinkerException e) {
// TrustedGuardingDynamicLinkerExporter threw exception on TestLinkerOperation as expected!
reachedAutoLinker = true;
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException(th);
}
@@ -270,9 +270,9 @@
MethodHandles.publicLookup(), op, mt)));
final boolean[] reachedGetMember = new boolean[1];
// check that the nashorn exported linker can be used for user defined JSObject
- Object obj = new AbstractJSObject() {
+ final Object obj = new AbstractJSObject() {
@Override
- public Object getMember(String name) {
+ public Object getMember(final String name) {
reachedGetMember[0] = true;
return name.equals("foo")? "bar" : "<unknown>";
}
@@ -281,7 +281,7 @@
Object value = null;
try {
value = cs.getTarget().invoke(obj);
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException(th);
}
@@ -304,7 +304,7 @@
try {
final Object obj = engine.eval("({ foo: 'hello' })");
value = cs.getTarget().invoke(obj);
- } catch (Throwable th) {
+ } catch (final Throwable th) {
throw new RuntimeException(th);
}
Assert.assertEquals(value, "hello");
--- a/nashorn/test/src/jdk/dynalink/test/TrustedGuardingDynamicLinkerExporter.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/dynalink/test/TrustedGuardingDynamicLinkerExporter.java Thu Oct 06 16:27:47 2016 +0200
@@ -40,7 +40,7 @@
@Override
public List<GuardingDynamicLinker> get() {
final ArrayList<GuardingDynamicLinker> linkers = new ArrayList<>();
- linkers.add((GuardingDynamicLinker) (LinkRequest linkRequest, LinkerServices linkerServices) -> {
+ linkers.add((GuardingDynamicLinker) (final LinkRequest linkRequest, final LinkerServices linkerServices) -> {
// handle only the TestLinkerOperation instances
if (linkRequest.getCallSiteDescriptor().getOperation() instanceof TestLinkerOperation) {
System.out.println("inside " + this.getClass().getName());
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/JDK_8148140_Test.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/JDK_8148140_Test.java Thu Oct 06 16:27:47 2016 +0200
@@ -54,7 +54,7 @@
return true;
}
@Override
- public Object call(Object thiz, Object... args) {
+ public Object call(final Object thiz, final Object... args) {
return Arrays.deepToString(args);
}
});
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -737,52 +737,52 @@
try {
c.getAttribute("");
throw new AssertionError("should have thrown IAE");
- } catch (IllegalArgumentException iae1) {}
+ } catch (final IllegalArgumentException iae1) {}
try {
c.getAttribute(null);
throw new AssertionError("should have thrown NPE");
- } catch (NullPointerException npe1) {}
+ } catch (final NullPointerException npe1) {}
try {
c.getAttribute("", ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown IAE");
- } catch (IllegalArgumentException iae2) {}
+ } catch (final IllegalArgumentException iae2) {}
try {
c.getAttribute(null, ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown NPE");
- } catch (NullPointerException npe2) {}
+ } catch (final NullPointerException npe2) {}
try {
c.removeAttribute("", ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown IAE");
- } catch (IllegalArgumentException iae3) {}
+ } catch (final IllegalArgumentException iae3) {}
try {
c.removeAttribute(null, ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown NPE");
- } catch (NullPointerException npe3) {}
+ } catch (final NullPointerException npe3) {}
try {
c.setAttribute("", "value", ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown IAE");
- } catch (IllegalArgumentException iae4) {}
+ } catch (final IllegalArgumentException iae4) {}
try {
c.setAttribute(null, "value", ScriptContext.ENGINE_SCOPE);
throw new AssertionError("should have thrown NPE");
- } catch (NullPointerException npe4) {}
+ } catch (final NullPointerException npe4) {}
try {
c.getAttributesScope("");
throw new AssertionError("should have thrown IAE");
- } catch (IllegalArgumentException iae5) {}
+ } catch (final IllegalArgumentException iae5) {}
try {
c.getAttributesScope(null);
throw new AssertionError("should have thrown NPE");
- } catch (NullPointerException npe5) {}
+ } catch (final NullPointerException npe5) {}
}
public static class RecursiveEval {
@@ -791,8 +791,8 @@
private final Bindings engineBindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
public void program() throws ScriptException {
- ScriptContext sc = new SimpleScriptContext();
- Bindings global = new SimpleBindings();
+ final ScriptContext sc = new SimpleScriptContext();
+ final Bindings global = new SimpleBindings();
sc.setBindings(global, ScriptContext.GLOBAL_SCOPE);
sc.setBindings(engineBindings, ScriptContext.ENGINE_SCOPE);
global.put("text", "programText");
@@ -812,7 +812,7 @@
sc.setBindings(global, ScriptContext.GLOBAL_SCOPE);
sc.setBindings(engineBindings, ScriptContext.ENGINE_SCOPE);
global.put("text", "methodText");
- String value = engine.eval("text", sc).toString();
+ final String value = engine.eval("text", sc).toString();
Assert.assertEquals(value, "methodText");
}
}
@@ -878,7 +878,7 @@
engine.eval("newfunc = function() { return func() }");
// call "newfunc" and check the return value
- Object value = ((Invocable)engine).invokeFunction("newfunc");
+ final Object value = ((Invocable)engine).invokeFunction("newfunc");
assertTrue(((Number)value).intValue() == 42);
}
@@ -910,7 +910,7 @@
engine.eval("newfunc = function() { return func() }");
// call "newfunc" and check the return value
- Object value = ((Invocable)engine).invokeFunction("newfunc");
+ final Object value = ((Invocable)engine).invokeFunction("newfunc");
assertTrue(((Number)value).intValue() == 42);
}
@@ -922,18 +922,18 @@
final ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
// create an engine and a ScriptContext, but don't set it as default
- ScriptContext scriptContext = new SimpleScriptContext();
+ final ScriptContext scriptContext = new SimpleScriptContext();
// Set some value in the context
scriptContext.setAttribute("myString", "foo", ScriptContext.ENGINE_SCOPE);
// Evaluate script with custom context and get back a function
final String script = "function (c) { return myString.indexOf(c); }";
- CompiledScript compiledScript = ((Compilable)engine).compile(script);
- Object func = compiledScript.eval(scriptContext);
+ final CompiledScript compiledScript = ((Compilable)engine).compile(script);
+ final Object func = compiledScript.eval(scriptContext);
// Invoked function should be able to see context it was evaluated with
- Object result = ((Invocable) engine).invokeMethod(func, "call", func, "o", null);
+ final Object result = ((Invocable) engine).invokeMethod(func, "call", func, "o", null);
assertTrue(((Number)result).intValue() == 1);
}
}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -683,7 +683,7 @@
final ScriptEngineManager manager = new ScriptEngineManager();
final ScriptEngine e = manager.getEngineByName("nashorn");
// no exception expected here!
- Object value = e.getFactory().getParameter("no value assigned to this key");
+ final Object value = e.getFactory().getParameter("no value assigned to this key");
assertNull(value);
}
@@ -695,7 +695,7 @@
final AtomicBoolean invoked = new AtomicBoolean(false);
e.put("f", new Function<String, String>() {
@Override
- public String apply(String t) {
+ public String apply(final String t) {
invoked.set(true);
return t;
}
@@ -712,7 +712,7 @@
final AtomicBoolean invoked = new AtomicBoolean(false);
e.put("c", new Consumer<Object>() {
@Override
- public void accept(Object t) {
+ public void accept(final Object t) {
assertTrue(t instanceof ScriptObjectMirror);
assertEquals(((ScriptObjectMirror)t).get("a"), "xyz");
invoked.set(true);
@@ -740,14 +740,14 @@
try {
e.put(null, "null-value");
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
e.put("", "empty-value");
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
@@ -757,98 +757,98 @@
try {
b.put(null, "null-value");
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.put("", "empty-value");
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
try {
b.get(null);
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.get("");
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
try {
b.get(1);
fail();
- } catch (ClassCastException x) {
+ } catch (final ClassCastException x) {
// expected
}
try {
b.remove(null);
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.remove("");
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
try {
b.remove(1);
fail();
- } catch (ClassCastException x) {
+ } catch (final ClassCastException x) {
// expected
}
try {
b.containsKey(null);
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.containsKey("");
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
try {
b.containsKey(1);
fail();
- } catch (ClassCastException x) {
+ } catch (final ClassCastException x) {
// expected
}
try {
b.putAll(null);
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.putAll(Collections.singletonMap((String)null, "null-value"));
fail();
- } catch (NullPointerException x) {
+ } catch (final NullPointerException x) {
// expected
}
try {
b.putAll(Collections.singletonMap("", "empty-value"));
fail();
- } catch (IllegalArgumentException x) {
+ } catch (final IllegalArgumentException x) {
// expected
}
}
--- a/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java Thu Oct 06 16:27:47 2016 +0200
@@ -53,9 +53,9 @@
private static final String TEST262_SUITE_DIR;
static {
- String testSrc = System.getProperty("test.src");
+ final String testSrc = System.getProperty("test.src");
if (testSrc != null) {
- String testScriptDir = testSrc + "/../../../../../../script/";
+ final String testScriptDir = testSrc + "/../../../../../../script/";
TEST_BASIC_DIR = testScriptDir + "basic";
TEST_MAPTESTS_DIR = testScriptDir + "maptests";
TEST_SANDBOX_DIR = testScriptDir + "sandbox";
@@ -74,7 +74,7 @@
public boolean exclude(File file, String content);
}
- private void log(String msg) {
+ private void log(final String msg) {
org.testng.Reporter.log(msg, true);
}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/doubleconv/test/BignumTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/doubleconv/test/BignumTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -97,8 +97,8 @@
@Test
public void testAssign() throws Exception {
- Object bignum = ctor.newInstance();
- Object bignum2 = ctor.newInstance();
+ final Object bignum = ctor.newInstance();
+ final Object bignum2 = ctor.newInstance();
final Method assignUInt16 = method("assignUInt16", char.class);
final Method assignUInt64 = method("assignUInt64", long.class);
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/doubleconv/test/IeeeDoubleTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/doubleconv/test/IeeeDoubleTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -228,8 +228,8 @@
@Test
public void testNormalizedBoundaries() throws Exception {
- Object boundary_plus = DiyFpCtor.newInstance();
- Object boundary_minus = DiyFpCtor.newInstance();
+ final Object boundary_plus = DiyFpCtor.newInstance();
+ final Object boundary_minus = DiyFpCtor.newInstance();
Object diy_fp = asNormalizedDiyFp.invoke(null, doubleToLong.invoke(null, 1.5));
normalizedBoundaries.invoke(null, doubleToLong.invoke(null, 1.5), boundary_minus, boundary_plus);
assertEquals(e.invoke(diy_fp), e.invoke(boundary_minus));
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/linker/test/NameCodecTest.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/linker/test/NameCodecTest.java Thu Oct 06 16:27:47 2016 +0200
@@ -60,11 +60,11 @@
static final String REPLACEMENT_CHARS = "-|,?!%{}^_";
static String[][] canonicalSamples() {
- int ndc = DANGEROUS_CHARS.length();
- String[][] res = new String[2 * ndc][];
+ final int ndc = DANGEROUS_CHARS.length();
+ final String[][] res = new String[2 * ndc][];
for (int i = 0; i < ndc; i++) {
- char dc = DANGEROUS_CHARS.charAt(i);
- char rc = REPLACEMENT_CHARS.charAt(i);
+ final char dc = DANGEROUS_CHARS.charAt(i);
+ final char rc = REPLACEMENT_CHARS.charAt(i);
if (dc == '\\') {
res[2 * i + 0] = new String[]{"\\-%", "\\%"};
} else {
@@ -82,11 +82,11 @@
testEncode(canonicalSamples());
}
- private void testEncode(String[][] samples) {
- for (String[] sample : samples) {
- String s = sample[1];
- String expResult = sample[0];
- String result = NameCodec.encode(s);
+ private void testEncode(final String[][] samples) {
+ for (final String[] sample : samples) {
+ final String s = sample[1];
+ final String expResult = sample[0];
+ final String result = NameCodec.encode(s);
if (!result.equals(expResult)) {
System.out.println(s + " => " + result + " != " + expResult);
}
@@ -101,11 +101,11 @@
testDecode(canonicalSamples());
}
- private void testDecode(String[][] samples) {
- for (String[] sample : samples) {
- String s = sample[0];
- String expResult = sample[1];
- String result = NameCodec.decode(s);
+ private void testDecode(final String[][] samples) {
+ for (final String[] sample : samples) {
+ final String s = sample[0];
+ final String expResult = sample[1];
+ final String result = NameCodec.decode(s);
assertEquals(expResult, result);
}
}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Thu Oct 06 16:27:47 2016 +0200
@@ -224,8 +224,8 @@
boolean explicitOptimistic = false;
- String allContent = new String(Files.readAllBytes(testFile));
- Iterator<String> scanner = Shell.tokenizeString(allContent).iterator();
+ final String allContent = new String(Files.readAllBytes(testFile));
+ final Iterator<String> scanner = Shell.tokenizeString(allContent).iterator();
while (scanner.hasNext()) {
// TODO: Scan for /ref=file qualifiers, etc, to determine run
// behavior
--- a/nashorn/test/src/jdk/nashorn/test/models/BigAbstract.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/test/models/BigAbstract.java Thu Oct 06 16:27:47 2016 +0200
@@ -26,7 +26,7 @@
package jdk.nashorn.test.models;
public abstract class BigAbstract {
- public static void accept(BigAbstract ba) {
+ public static void accept(final BigAbstract ba) {
}
public abstract void f0();
--- a/nashorn/test/src/jdk/nashorn/test/models/Jdk8072596TestSubject.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/test/models/Jdk8072596TestSubject.java Thu Oct 06 16:27:47 2016 +0200
@@ -49,7 +49,7 @@
}
// Test having to wrap some arguments but not others, and a vararg array
- public void test2(String x, final Object y, final ScriptObject w, final Object... z) {
+ public void test2(final String x, final Object y, final ScriptObject w, final Object... z) {
test1(x, y, w);
Assert.assertEquals(z.length, 2);
--- a/nashorn/test/src/jdk/nashorn/test/models/Reflector.java Wed Oct 05 13:38:12 2016 +0530
+++ b/nashorn/test/src/jdk/nashorn/test/models/Reflector.java Thu Oct 06 16:27:47 2016 +0200
@@ -42,7 +42,7 @@
private Reflector() {}
private static final Module NASHORN_MOD = Context.class.getModule();
- public static Object invoke(Method m, Object self, Object...args) {
+ public static Object invoke(final Method m, final Object self, final Object...args) {
if (m.getDeclaringClass().getModule() != NASHORN_MOD) {
throw new RuntimeException(m + " is not from Nashorn module");
}
@@ -58,7 +58,7 @@
}
}
- public static Object newInstance(Constructor c, Object...args) {
+ public static Object newInstance(final Constructor c, final Object...args) {
if (c.getDeclaringClass().getModule() != NASHORN_MOD) {
throw new RuntimeException(c + " is not from Nashorn module");
}
@@ -74,7 +74,7 @@
}
}
- public static Object get(Field f, Object self) {
+ public static Object get(final Field f, final Object self) {
if (f.getDeclaringClass().getModule() != NASHORN_MOD) {
throw new RuntimeException(f + " is not from Nashorn module");
}