Tidy up some code that performs unchecked casts to a generic type

This commit is contained in:
Ben Liblit 2017-08-06 19:18:33 -05:00 committed by Manu Sridharan
parent daea7095e2
commit 5bcc985069
2 changed files with 8 additions and 8 deletions

View File

@ -85,13 +85,13 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error

View File

@ -12,7 +12,6 @@ package com.ibm.wala.cast.test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
@ -35,7 +34,6 @@ public class TestCAstPattern extends WalaTestCase {
private final Map<String, Object> testNameMap = new HashMap<>();
@Override
@SuppressWarnings("unchecked")
public CAstNode makeNode(int kind, CAstNode children[]) {
if (kind == NAME_ASSERTION_SINGLE || kind == NAME_ASSERTION_MULTI) {
assert children.length == 2;
@ -47,11 +45,13 @@ public class TestCAstPattern extends WalaTestCase {
if (kind == NAME_ASSERTION_SINGLE) {
testNameMap.put(name, children[1]);
} else {
if (!testNameMap.containsKey(name)) {
testNameMap.put(name, new ArrayList<>());
@SuppressWarnings("unchecked")
ArrayList<CAstNode> nodeList = (ArrayList<CAstNode>) testNameMap.get(name);
if (nodeList == null) {
nodeList = new ArrayList<>();
testNameMap.put(name, nodeList);
}
((List<CAstNode>) testNameMap.get(children[0].getValue())).add(children[1]);
nodeList.add(children[1]);
}
return children[1];
} else {