Tidy up some code that performs unchecked casts to a generic type
This commit is contained in:
parent
daea7095e2
commit
5bcc985069
|
@ -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.reportMethodCanBeStatic=error
|
||||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
|
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.suppressWarnings=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
|
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
|
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.unclosedCloseable=error
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||||
|
|
|
@ -12,7 +12,6 @@ package com.ibm.wala.cast.test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -35,7 +34,6 @@ public class TestCAstPattern extends WalaTestCase {
|
||||||
private final Map<String, Object> testNameMap = new HashMap<>();
|
private final Map<String, Object> testNameMap = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public CAstNode makeNode(int kind, CAstNode children[]) {
|
public CAstNode makeNode(int kind, CAstNode children[]) {
|
||||||
if (kind == NAME_ASSERTION_SINGLE || kind == NAME_ASSERTION_MULTI) {
|
if (kind == NAME_ASSERTION_SINGLE || kind == NAME_ASSERTION_MULTI) {
|
||||||
assert children.length == 2;
|
assert children.length == 2;
|
||||||
|
@ -47,11 +45,13 @@ public class TestCAstPattern extends WalaTestCase {
|
||||||
if (kind == NAME_ASSERTION_SINGLE) {
|
if (kind == NAME_ASSERTION_SINGLE) {
|
||||||
testNameMap.put(name, children[1]);
|
testNameMap.put(name, children[1]);
|
||||||
} else {
|
} else {
|
||||||
if (!testNameMap.containsKey(name)) {
|
@SuppressWarnings("unchecked")
|
||||||
testNameMap.put(name, new ArrayList<>());
|
ArrayList<CAstNode> nodeList = (ArrayList<CAstNode>) testNameMap.get(name);
|
||||||
|
if (nodeList == null) {
|
||||||
|
nodeList = new ArrayList<>();
|
||||||
|
testNameMap.put(name, nodeList);
|
||||||
}
|
}
|
||||||
|
nodeList.add(children[1]);
|
||||||
((List<CAstNode>) testNameMap.get(children[0].getValue())).add(children[1]);
|
|
||||||
}
|
}
|
||||||
return children[1];
|
return children[1];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue