Fix most unchecked/deprecation javac warnings in compiler modules

This commit is contained in:
Alexander Udalov
2018-06-22 12:57:04 +02:00
parent 4f0c31eff3
commit f868964e25
64 changed files with 182 additions and 132 deletions
@@ -28,13 +28,13 @@ abstract class AbstractNode extends HasMetadata implements JsNode {
return out.toString();
}
@SuppressWarnings("unchecked")
protected <T extends HasMetadata & JsNode> T withMetadataFrom(T other) {
this.copyMetadataFrom(other);
Object otherSource = other.getSource();
if (otherSource != null) {
source(otherSource);
}
//noinspection unchecked
return (T) this;
}
}
@@ -100,6 +100,7 @@ public class JsFor extends SourceInfoAwareJsNode implements JsLoop {
}
@Override
@SuppressWarnings("unchecked")
public void traverse(JsVisitorWithContext v, JsContext ctx) {
if (v.visit(this, ctx)) {
assert (!(initExpression != null && initVars != null));
@@ -48,10 +48,10 @@ public abstract class JsVisitorWithContext {
doAcceptList(collection);
}
@SuppressWarnings("unchecked")
public final <T extends JsStatement> T acceptStatement(T statement) {
if (statement == null) return null;
//noinspection unchecked
return (T) doAcceptStatement(statement);
}
@@ -7,9 +7,6 @@ package org.jetbrains.kotlin.js.util;
import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.js.backend.ast.JsBinaryOperation;
import org.jetbrains.kotlin.js.backend.ast.JsBinaryOperator;
import org.jetbrains.kotlin.js.backend.ast.JsExpression;
import org.jetbrains.kotlin.js.backend.ast.JsNode;
import java.util.ArrayList;
@@ -20,10 +17,10 @@ public final class AstUtil {
}
@Nullable
@SuppressWarnings("unchecked")
public static <T extends JsNode> T deepCopy(@Nullable T node) {
if (node == null) return null;
//noinspection unchecked
return (T) node.deepCopy();
}