Fix remaining "unlikely argument type" warnings from Eclipse Oxygen

Each of these required careful consideration of what the original
developer *intended* as distinguished from what the developer's code
actually *does*.  I believe I got each one right, and WALA's
regression tests agree.  A second opinion by a core WALA developer
would be welcome, though.
This commit is contained in:
Ben Liblit 2017-08-06 18:37:46 -05:00 committed by Manu Sridharan
parent cb6d3b282a
commit bb6be21e2d
6 changed files with 11 additions and 10 deletions

View File

@ -95,7 +95,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore

View File

@ -177,7 +177,7 @@ public abstract class TestCAstTranslator extends WalaTestCase {
Assert.assertTrue("found class " + cls.getName().toString(), classes.contains(cls.getName().toString()));
if (cls.getSuperclass() == null) {
Assert.assertTrue(cls.getName() + " has no superclass", supers.get(cls.getName()) == null);
Assert.assertTrue(cls.getName() + " has no superclass", supers.get(cls.getName().toString()) == null);
} else {
Assert.assertTrue("super of " + cls.getName() + " is " + cls.getSuperclass().getName(), supers
.get(cls.getName().toString()).equals(cls.getSuperclass().getName().toString()));

View File

@ -97,7 +97,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore

View File

@ -41,13 +41,14 @@ public class CAstCloner extends CAstBasicRewriter {
* what is the hack here? --MS
*/
protected CAstNode copyNodesHackForEclipse(CAstNode root, final CAstControlFlowMap cfg, NonCopyingContext c, Map<Pair<CAstNode,NoKey>, CAstNode> nodeMap) {
final Pair<CAstNode, NoKey> pairKey = Pair.make(root, c.key());
if (root instanceof CAstOperator) {
nodeMap.put(Pair.make(root, c.key()), root);
nodeMap.put(pairKey, root);
return root;
} else if (root.getValue() != null) {
CAstNode copy = Ast.makeConstant(root.getValue());
assert !nodeMap.containsKey(root);
nodeMap.put(Pair.make(root, c.key()), copy);
assert !nodeMap.containsKey(pairKey);
nodeMap.put(pairKey, copy);
return copy;
} else {
CAstNode newChildren[] = new CAstNode[root.getChildCount()];
@ -57,8 +58,8 @@ public class CAstCloner extends CAstBasicRewriter {
}
CAstNode copy = Ast.makeNode(root.getKind(), newChildren);
assert !nodeMap.containsKey(root);
nodeMap.put(Pair.make(root, c.key()), copy);
assert !nodeMap.containsKey(pairKey);
nodeMap.put(pairKey, copy);
return copy;
}
}

View File

@ -106,7 +106,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore

View File

@ -118,7 +118,7 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
for (DirectedHyperEdge<Integer> edge:constantNode.getOutEdges()) {
if (!edge.getDestination().contains(helper2)) {
edge.getSource().remove(constant);
edge.getSource().remove(constantNode);
edge.getSource().add(helper1);
}
}