Community
Participate
Working Groups
This bug is similar to the already verified fixed bug #62822. The following test case produces the error message: Bound mismatch: The type R is not a valid substitute for the bounded parameter <R extends Foo<R>> of the type Bar<R> Note that if you do a clean and a build it works, but as soon as you change the FooImpl.java file and save it again, the error message appears. ---------------------- Test case: public interface Bar<R extends Foo<R>> {} public class BarImpl<R extends Foo<R>> implements Bar<R> {} public interface Foo<R extends Foo<R>> extends Bar<R> {} public class FooImpl<R extends Foo<R>> extends BarImpl<R> implements Foo<R> {}
I have forgotten where exactly the error appears. In the FooImpl.java file: public class FooImpl<R extends Foo<R>> extends BarImpl<R> implements Foo<R> {} -------------------------------------^^^
Reproduced only in incremental mode; that is when FooImpl is compiled independantly from the rest (either direclty by touching it, or indirectly when adding a signature to one of its referenced types). Problem would thus lie in some generated parameter bound lying in required classfile. Added GenericTypeTest#test519-520.
Actually problem rather probably lives in lazy supertype resolution. After renaming type parameters to better see what is going on: interface Bar<R extends Foo<R>> {} class BarImpl<S extends Foo<S>> implements Bar<S> {} interface Foo<T extends Foo<T>> extends Bar<T> {} class FooImpl<U extends Foo<U>> extends BarImpl<U> implements Foo<U> {} ---------- 1. ERROR in FooImpl.java (at line 1) public class FooImpl<U extends Foo<U>> extends BarImpl<U> implements Foo<U> {} ^^^ Bound mismatch: The type T is not a valid substitute for the bounded parameter <R extends Foo<R>> of the type Bar<R> ---------- There seems to be some confusion, as variable T shouldn't be considered when resolving FooImpl hierarchy, it should only see substituted form with U.
Fixed. Needed to change Scope.substitute() so it didn't answer Binary types as replacements for Parameterized types.
Verified in I20050330-0500