8180720: method InferenceGraph.initNodes() can potentially add a trivial dependency of a node to itself
Reviewed-by: mcimadamore
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Mon May 22 15:50:09 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Mon May 22 09:44:14 2017 -0700
@@ -1889,10 +1889,13 @@
Type i = n_i.data.first();
for (Node n_j : nodes) {
Type j = n_j.data.first();
- UndetVar uv_i = (UndetVar)inferenceContext.asUndetVar(i);
- if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
- //update i's bound dependencies
- n_i.addDependency(n_j);
+ // don't compare a variable to itself
+ if (i != j) {
+ UndetVar uv_i = (UndetVar)inferenceContext.asUndetVar(i);
+ if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
+ //update i's bound dependencies
+ n_i.addDependency(n_j);
+ }
}
}
}