8081809: Missing final modifier in method parameters (nashorn code convention)
Reviewed-by: attila, hannesw
This commit is contained in:
parent
b7ecae1bb9
commit
105784b853
@ -39,6 +39,7 @@
|
||||
|
||||
var Class = Java.type("java.lang.Class");
|
||||
var System = Java.type("java.lang.System");
|
||||
var Thread = Java.type("java.lang.Thread");
|
||||
var File = Java.type("java.io.File");
|
||||
var JarFile = Java.type("java.util.jar.JarFile");
|
||||
var Modifier = Java.type("java.lang.reflect.Modifier");
|
||||
@ -58,6 +59,10 @@ function findNashorn() {
|
||||
function analyzeClass(cls) {
|
||||
var methods = cls.getDeclaredMethods();
|
||||
for each (var method in methods) {
|
||||
var methodModifiers = method.modifiers;
|
||||
if (Modifier.isAbstract(methodModifiers) || Modifier.isNative(methodModifiers)) {
|
||||
continue;
|
||||
}
|
||||
// this requires -parameters option when compiling java sources
|
||||
var params = method.parameters;
|
||||
for each (var p in params) {
|
||||
@ -73,6 +78,8 @@ function analyzeClass(cls) {
|
||||
}
|
||||
|
||||
var jarFile = findNashorn();
|
||||
var ctxtLoader = Thread.currentThread().contextClassLoader;
|
||||
|
||||
// load each class and use reflection to analyze each Class
|
||||
new JarFile(jarFile).stream().forEach(
|
||||
function(entry) {
|
||||
@ -80,8 +87,15 @@ new JarFile(jarFile).stream().forEach(
|
||||
if (name.endsWith(".class")) {
|
||||
var clsName = name.substring(0, name.lastIndexOf('.class'));
|
||||
clsName = clsName.replace(/\//g, '.');
|
||||
var cls = Class.forName(clsName);
|
||||
analyzeClass(cls);
|
||||
try {
|
||||
// don't initialize to avoid for possible initialization errors
|
||||
var cls = Class.forName(clsName, false, ctxtLoader);
|
||||
analyzeClass(cls);
|
||||
} catch (e) {
|
||||
// print exception and continue analysis for other classes
|
||||
print("Failed to analyze " + clsName);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ final class ArrayAccessTreeImpl extends ExpressionTreeImpl implements ArrayAcces
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitArrayAccess(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ final class ArrayLiteralTreeImpl extends ExpressionTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitArrayLiteral(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ final class AssignmentTreeImpl extends ExpressionTreeImpl implements AssignmentT
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitAssignment(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class BinaryTreeImpl extends ExpressionTreeImpl implements BinaryTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitBinary(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class BlockTreeImpl extends StatementTreeImpl implements BlockTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitBlock(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ final class BreakTreeImpl extends StatementTreeImpl implements BreakTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitBreak(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ final class CaseTreeImpl extends TreeImpl implements CaseTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitCase(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ final class CatchTreeImpl extends TreeImpl implements CatchTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitCatch(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ final class CompilationUnitTreeImpl extends TreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitCompilationUnit(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ final class CompoundAssignmentTreeImpl extends ExpressionTreeImpl implements Com
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitCompoundAssignment(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ final class ConditionalExpressionTreeImpl extends ExpressionTreeImpl implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitConditionalExpression(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ final class ContinueTreeImpl extends StatementTreeImpl implements ContinueTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitContinue(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ final class DebuggerTreeImpl extends StatementTreeImpl implements DebuggerTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitDebugger(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ final class DoWhileLoopTreeImpl extends StatementTreeImpl implements DoWhileLoop
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitDoWhileLoop(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ final class EmptyStatementTreeImpl extends StatementTreeImpl implements EmptySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitEmptyStatement(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ final class ErroneousTreeImpl extends ExpressionTreeImpl implements ErroneousTre
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitErroneous(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ final class ExpressionStatementTreeImpl extends StatementTreeImpl implements Exp
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitExpressionStatement(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ final class ForInLoopTreeImpl extends StatementTreeImpl implements ForInLoopTree
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitForInLoop(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ final class ForLoopTreeImpl extends StatementTreeImpl implements ForLoopTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitForLoop(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class FunctionCallTreeImpl extends ExpressionTreeImpl implements FunctionCallTre
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitFunctionCall(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ final class FunctionDeclarationTreeImpl extends StatementTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitFunctionDeclaration(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ final class FunctionExpressionTreeImpl extends ExpressionTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitFunctionExpression(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ final class IdentifierTreeImpl extends ExpressionTreeImpl implements IdentifierT
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitIdentifier(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ final class IfTreeImpl extends StatementTreeImpl implements IfTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitIf(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ final class InstanceOfTreeImpl extends BinaryTreeImpl implements InstanceOfTree
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitInstanceOf(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ final class LabeledStatementTreeImpl extends StatementTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitLabeledStatement(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ final class LineMapImpl implements LineMap {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLineNumber(long pos) {
|
||||
public long getLineNumber(final long pos) {
|
||||
return source.getLine((int)pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getColumnNumber(long pos) {
|
||||
public long getColumnNumber(final long pos) {
|
||||
return source.getColumn((int)pos);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ final class LiteralTreeImpl extends ExpressionTreeImpl implements LiteralTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitLiteral(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class MemberSelectTreeImpl extends ExpressionTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitMemberSelect(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ final class NewTreeImpl extends ExpressionTreeImpl implements NewTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(TreeVisitor<R, D> visitor, D data) {
|
||||
public <R, D> R accept(final TreeVisitor<R, D> visitor, final D data) {
|
||||
return visitor.visitNew(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ final class ObjectLiteralTreeImpl extends ExpressionTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitObjectLiteral(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ final class PropertyTreeImpl extends TreeImpl implements PropertyTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitProperty(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ final class RegExpLiteralTreeImpl extends ExpressionTreeImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitRegExpLiteral(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ final class ReturnTreeImpl extends StatementTreeImpl implements ReturnTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitReturn(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -48,28 +48,28 @@ package jdk.nashorn.api.tree;
|
||||
*/
|
||||
public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
@Override
|
||||
public R visitAssignment(AssignmentTree node, P r) {
|
||||
public R visitAssignment(final AssignmentTree node, final P r) {
|
||||
node.getVariable().accept(this, r);
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitCompoundAssignment(CompoundAssignmentTree node, P r) {
|
||||
public R visitCompoundAssignment(final CompoundAssignmentTree node, final P r) {
|
||||
node.getVariable().accept(this, r);
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitBinary(BinaryTree node, P r) {
|
||||
public R visitBinary(final BinaryTree node, final P r) {
|
||||
node.getLeftOperand().accept(this, r);
|
||||
node.getRightOperand().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitBlock(BlockTree node, P r) {
|
||||
public R visitBlock(final BlockTree node, final P r) {
|
||||
node.getStatements().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -77,12 +77,12 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitBreak(BreakTree node, P r) {
|
||||
public R visitBreak(final BreakTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitCase(CaseTree node, P r) {
|
||||
public R visitCase(final CaseTree node, final P r) {
|
||||
final Tree caseVal = node.getExpression();
|
||||
if (caseVal != null) {
|
||||
caseVal.accept(this, r);
|
||||
@ -95,7 +95,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitCatch(CatchTree node, P r) {
|
||||
public R visitCatch(final CatchTree node, final P r) {
|
||||
final Tree cond = node.getCondition();
|
||||
if (cond != null) {
|
||||
cond.accept(this, r);
|
||||
@ -106,7 +106,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitConditionalExpression(ConditionalExpressionTree node, P r) {
|
||||
public R visitConditionalExpression(final ConditionalExpressionTree node, final P r) {
|
||||
node.getCondition().accept(this, r);
|
||||
node.getTrueExpression().accept(this, r);
|
||||
node.getFalseExpression().accept(this, r);
|
||||
@ -114,35 +114,35 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitContinue(ContinueTree node, P r) {
|
||||
public R visitContinue(final ContinueTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitDebugger(DebuggerTree node, P r) {
|
||||
public R visitDebugger(final DebuggerTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitDoWhileLoop(DoWhileLoopTree node, P r) {
|
||||
public R visitDoWhileLoop(final DoWhileLoopTree node, final P r) {
|
||||
node.getStatement().accept(this, r);
|
||||
node.getCondition().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitErroneous(ErroneousTree node, P r) {
|
||||
public R visitErroneous(final ErroneousTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitExpressionStatement(ExpressionStatementTree node, P r) {
|
||||
public R visitExpressionStatement(final ExpressionStatementTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitForLoop(ForLoopTree node, P r) {
|
||||
public R visitForLoop(final ForLoopTree node, final P r) {
|
||||
final Tree init = node.getInitializer();
|
||||
if (init != null) {
|
||||
init.accept(this, r);
|
||||
@ -163,7 +163,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitForInLoop(ForInLoopTree node, P r) {
|
||||
public R visitForInLoop(final ForInLoopTree node, final P r) {
|
||||
node.getVariable().accept(this, r);
|
||||
node.getExpression().accept(this, r);
|
||||
final StatementTree stat = node.getStatement();
|
||||
@ -174,7 +174,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitFunctionCall(FunctionCallTree node, P r) {
|
||||
public R visitFunctionCall(final FunctionCallTree node, final P r) {
|
||||
node.getFunctionSelect().accept(this, r);
|
||||
node.getArguments().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
@ -183,7 +183,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitFunctionDeclaration(FunctionDeclarationTree node, P r) {
|
||||
public R visitFunctionDeclaration(final FunctionDeclarationTree node, final P r) {
|
||||
node.getParameters().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -192,7 +192,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitFunctionExpression(FunctionExpressionTree node, P r) {
|
||||
public R visitFunctionExpression(final FunctionExpressionTree node, final P r) {
|
||||
node.getParameters().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -201,12 +201,12 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitIdentifier(IdentifierTree node, P r) {
|
||||
public R visitIdentifier(final IdentifierTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitIf(IfTree node, P r) {
|
||||
public R visitIf(final IfTree node, final P r) {
|
||||
node.getCondition().accept(this, r);
|
||||
node.getThenStatement().accept(this, r);
|
||||
final Tree elseStat = node.getElseStatement();
|
||||
@ -217,14 +217,14 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitArrayAccess(ArrayAccessTree node, P r) {
|
||||
public R visitArrayAccess(final ArrayAccessTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
node.getIndex().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitArrayLiteral(ArrayLiteralTree node, P r) {
|
||||
public R visitArrayLiteral(final ArrayLiteralTree node, final P r) {
|
||||
node.getElements().stream().filter((tree) -> (tree != null)).forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -232,24 +232,24 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitLabeledStatement(LabeledStatementTree node, P r) {
|
||||
public R visitLabeledStatement(final LabeledStatementTree node, final P r) {
|
||||
node.getStatement().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitLiteral(LiteralTree node, P r) {
|
||||
public R visitLiteral(final LiteralTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitParenthesized(ParenthesizedTree node, P r) {
|
||||
public R visitParenthesized(final ParenthesizedTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitReturn(ReturnTree node, P r) {
|
||||
public R visitReturn(final ReturnTree node, final P r) {
|
||||
final Tree retExpr = node.getExpression();
|
||||
if (retExpr != null) {
|
||||
retExpr.accept(this, r);
|
||||
@ -258,19 +258,19 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitMemberSelect(MemberSelectTree node, P r) {
|
||||
public R visitMemberSelect(final MemberSelectTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitNew(NewTree node, P r) {
|
||||
public R visitNew(final NewTree node, final P r) {
|
||||
node.getConstructorExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitObjectLiteral(ObjectLiteralTree node, P r) {
|
||||
public R visitObjectLiteral(final ObjectLiteralTree node, final P r) {
|
||||
node.getProperties().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -278,7 +278,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitProperty(PropertyTree node, P r) {
|
||||
public R visitProperty(final PropertyTree node, final P r) {
|
||||
FunctionExpressionTree getter = node.getGetter();
|
||||
if (getter != null) {
|
||||
getter.accept(this, r);
|
||||
@ -301,17 +301,17 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitRegExpLiteral(RegExpLiteralTree node, P r) {
|
||||
public R visitRegExpLiteral(final RegExpLiteralTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitEmptyStatement(EmptyStatementTree node, P r) {
|
||||
public R visitEmptyStatement(final EmptyStatementTree node, final P r) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitSwitch(SwitchTree node, P r) {
|
||||
public R visitSwitch(final SwitchTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
node.getCases().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
@ -320,13 +320,13 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitThrow(ThrowTree node, P r) {
|
||||
public R visitThrow(final ThrowTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitCompilationUnit(CompilationUnitTree node, P r) {
|
||||
public R visitCompilationUnit(final CompilationUnitTree node, final P r) {
|
||||
node.getSourceElements().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
});
|
||||
@ -334,7 +334,7 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitTry(TryTree node, P r) {
|
||||
public R visitTry(final TryTree node, final P r) {
|
||||
node.getBlock().accept(this, r);
|
||||
node.getCatches().forEach((tree) -> {
|
||||
tree.accept(this, r);
|
||||
@ -348,20 +348,20 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitInstanceOf(InstanceOfTree node, P r) {
|
||||
public R visitInstanceOf(final InstanceOfTree node, final P r) {
|
||||
node.getType().accept(this, r);
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitUnary(UnaryTree node, P r) {
|
||||
public R visitUnary(final UnaryTree node, final P r) {
|
||||
node.getExpression().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitVariable(VariableTree node, P r) {
|
||||
public R visitVariable(final VariableTree node, final P r) {
|
||||
if (node.getInitializer() != null) {
|
||||
node.getInitializer().accept(this, r);
|
||||
}
|
||||
@ -369,21 +369,21 @@ public class SimpleTreeVisitorES5_1<R, P> implements TreeVisitor<R, P> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitWhileLoop(WhileLoopTree node, P r) {
|
||||
public R visitWhileLoop(final WhileLoopTree node, final P r) {
|
||||
node.getCondition().accept(this, r);
|
||||
node.getStatement().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitWith(WithTree node, P r) {
|
||||
public R visitWith(final WithTree node, final P r) {
|
||||
node.getScope().accept(this, r);
|
||||
node.getStatement().accept(this, r);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitUnknown(Tree node, P r) {
|
||||
public R visitUnknown(final Tree node, final P r) {
|
||||
// unknown in ECMAScript 5.1 edition
|
||||
throw new UnknownTreeException(node, r);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ final class SwitchTreeImpl extends StatementTreeImpl implements SwitchTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitSwitch(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ final class ThrowTreeImpl extends StatementTreeImpl implements ThrowTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitThrow(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ abstract class TreeImpl implements Tree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitUnknown(this, data);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ final class TryTreeImpl extends StatementTreeImpl implements TryTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitTry(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class UnaryTreeImpl extends ExpressionTreeImpl implements UnaryTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitUnary(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class VariableTreeImpl extends StatementTreeImpl implements VariableTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitVariable(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ final class WhileLoopTreeImpl extends StatementTreeImpl implements WhileLoopTree
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitWhileLoop(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class WithTreeImpl extends StatementTreeImpl implements WithTree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> visitor, D data) {
|
||||
public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) {
|
||||
return visitor.visitWith(this, data);
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ enum CompilationPhase {
|
||||
//partial code generation
|
||||
final FunctionNode newFunctionNode = transformFunction(fn, new ReplaceCompileUnits() {
|
||||
@Override
|
||||
CompileUnit getReplacement(CompileUnit original) {
|
||||
CompileUnit getReplacement(final CompileUnit original) {
|
||||
return map.get(original);
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ public final class OptimisticTypesPersistence {
|
||||
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
|
||||
Files.walk(nashorn).forEach(new Consumer<Path>() {
|
||||
@Override
|
||||
public void accept(Path p) {
|
||||
public void accept(final Path p) {
|
||||
// take only the .class resources.
|
||||
if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
|
||||
try {
|
||||
|
@ -102,7 +102,7 @@ final class SplitIntoFunctions extends NodeVisitor<BlockLexicalContext> {
|
||||
public SplitIntoFunctions(final Compiler compiler) {
|
||||
super(new BlockLexicalContext() {
|
||||
@Override
|
||||
protected Block afterSetStatements(Block block) {
|
||||
protected Block afterSetStatements(final Block block) {
|
||||
for(Statement stmt: block.getStatements()) {
|
||||
assert !(stmt instanceof SplitNode);
|
||||
}
|
||||
@ -305,7 +305,7 @@ final class SplitIntoFunctions extends NodeVisitor<BlockLexicalContext> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enterVarNode(VarNode varNode) {
|
||||
public boolean enterVarNode(final VarNode varNode) {
|
||||
if (!inSplitNode()) {
|
||||
return super.enterVarNode(varNode);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public final class SplitReturn extends Statement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(StringBuilder sb, boolean printType) {
|
||||
public void toString(final StringBuilder sb, final boolean printType) {
|
||||
sb.append(":splitreturn;");
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public final class TryNode extends LexicalContextStatement implements JoinPredec
|
||||
* @param visitor IR navigating visitor.
|
||||
*/
|
||||
@Override
|
||||
public Node accept(final LexicalContext lc, NodeVisitor<? extends LexicalContext> visitor) {
|
||||
public Node accept(final LexicalContext lc, final NodeVisitor<? extends LexicalContext> visitor) {
|
||||
if (visitor.enterTryNode(this)) {
|
||||
// Need to do finallybody first for termination analysis. TODO still necessary?
|
||||
final Block newFinallyBody = finallyBody == null ? null : (Block)finallyBody.accept(visitor);
|
||||
|
@ -246,7 +246,7 @@ public class NashornBeansLinker implements GuardingDynamicLinker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodHandle filterInternalObjects(MethodHandle target) {
|
||||
public MethodHandle filterInternalObjects(final MethodHandle target) {
|
||||
return linkerServices.filterInternalObjects(target);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user