Community
Participate
Working Groups
Build I20071023-0800 Since changes for bug 158870, the following testcase produces a stack overflow when compiled. import java.util.*; class ExpressionGraph<G extends ExpressionGraph<G, V, L>, V extends ExpressionVertex<G, V, L>, L> extends AbstractGraph<G, V> { void foo(Set<V> set, Collection<? extends V> col) { if (set == col) return; } interface IVertex<G extends ExpressionGraph<G, V, L>, V extends IVertex<G, V, L>, L> extends ExpressionVertex<G, V, L> { // empty } static abstract class Vertex<G extends ExpressionGraph<G, V, L>, V extends IVertex<G, V, L>, L> implements IVertex<G, V, L> { // empty } } abstract class AbstractGraph<G extends AbstractGraph<G,V>, V extends Vertex<G,V>> implements Graph<G,V> { // empty } interface Graph<G extends Graph<G,V>, V extends Vertex<G,V>> { // empty } interface Vertex<G extends Graph<G,V>, V extends Vertex<G,V>> { // empty } interface ExpressionVertex<G extends Graph<G,V>, V extends ExpressionVertex<G,V,L>, L> extends Vertex<G,V> { // empty }
Simpler testcase: import java.util.*; class ExpressionGraph<G extends ExpressionGraph<G, V>, V extends IVertex<G, V>> { void foo(Set<V> set, Collection<? extends V> col) { if (set == col) return; } } interface IVertex<G extends ExpressionGraph<G, V>, V extends IVertex<G, V>> { // empty }
Added GenericTypeTest#test1204-1205
Created attachment 81057 [details] Proposed patch
Variable elimination shouldn't assume direct relationship, there can be forward references to type parameters, hence need for remembering visited variables (not just the last one).
Released for 3.4M3. Fixed
Fixed
Verified for 3.4 M3 using build I20071029-0010.