diff --git a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsGlobalBlock.java b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsGlobalBlock.java index 6948fe1c52a..a1910eea822 100644 --- a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsGlobalBlock.java +++ b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsGlobalBlock.java @@ -13,14 +13,10 @@ import java.util.List; * Represents a JavaScript block in the global scope. */ public class JsGlobalBlock extends JsBlock { - - public JsGlobalBlock() { - } - - @Override - public boolean isGlobalBlock() { - return true; - } + @Override + public boolean isGlobalBlock() { + return true; + } @NotNull @Override diff --git a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsVisitorWithContextImpl.java b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsVisitorWithContextImpl.java index d2b0dc8a816..a03e26c2502 100644 --- a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsVisitorWithContextImpl.java +++ b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/JsVisitorWithContextImpl.java @@ -14,7 +14,7 @@ package org.jetbrains.kotlin.js.backend.ast; -/** +/* * Taken from GWT project with modifications. * Original: * repository: https://gwt.googlesource.com/gwt @@ -33,15 +33,15 @@ import java.util.*; */ public class JsVisitorWithContextImpl extends JsVisitorWithContext { - protected final Stack> statementContexts = new Stack>(); + protected final Stack> statementContexts = new Stack<>(); public class ListContext extends JsContext { private List nodes; private int index; // Those are reset in every iteration of traverse() - private final List previous = new SmartList(); - private final List next = new SmartList(); + private final List previous = new SmartList<>(); + private final List next = new SmartList<>(); private boolean removed = false; @Override @@ -138,7 +138,7 @@ public class JsVisitorWithContextImpl extends JsVisitorWithContext { } } - protected static void checkReplacement(@SuppressWarnings("UnusedParameters") JsNode origNode, JsNode newNode) { + private static void checkReplacement(@SuppressWarnings("UnusedParameters") JsNode origNode, JsNode newNode) { if (newNode == null) throw new RuntimeException("Cannot replace with null"); } @@ -154,7 +154,7 @@ public class JsVisitorWithContextImpl extends JsVisitorWithContext { @Override protected JsStatement doAcceptStatement(T statement) { - List statements = new SmartList(statement); + List statements = new SmartList<>(statement); doAcceptStatementList(statements); if (statements.size() == 1) { @@ -166,7 +166,7 @@ public class JsVisitorWithContextImpl extends JsVisitorWithContext { @Override protected void doAcceptStatementList(List statements) { - ListContext context = new ListContext(); + ListContext context = new ListContext<>(); statementContexts.push(context); context.traverse(statements); statementContexts.pop(); diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/NamingContext.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/NamingContext.kt index 0ec08ef96db..6b74625a7f4 100644 --- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/NamingContext.kt +++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/NamingContext.kt @@ -18,16 +18,12 @@ package org.jetbrains.kotlin.js.inline.context import org.jetbrains.kotlin.js.backend.ast.* import org.jetbrains.kotlin.js.backend.ast.metadata.synthetic - -import java.util.ArrayList -import java.util.IdentityHashMap - -import org.jetbrains.kotlin.js.translate.utils.JsAstUtils import org.jetbrains.kotlin.js.inline.util.replaceNames +import org.jetbrains.kotlin.js.translate.utils.JsAstUtils class NamingContext(private val statementContext: JsContext) { - private val renamings = IdentityHashMap() - private val declarations = ArrayList() + private val renamings = mutableMapOf() + private val declarations = mutableListOf() private var addedDeclarations = false fun applyRenameTo(target: JsNode): JsNode {