Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Code not compiling with java7 but compiling with java6

955312Aug 12 2012 — edited Aug 15 2012
Hello all,

I have following class:
public class StrangeClass<T extends StrangeClass<S, T>, S extends StrangeClass<T, S>> {

public static void main(String[] args) throws InstantiationException, IllegalAccessException {
System.out.println("test");
}
}

It's compiling with eclipse (Java 7) and with java 6u33 (oracle) but not compiling with java 7u5 (oracle)

StrangeClass.java:1: error: type argument S is not within bounds of type-variable T
public class StrangeClass<T extends StrangeClass<S, T>, S extends StrangeClass<T, S>> {
^
where S,T are type-variables:
S extends StrangeClass<T,S> declared in class StrangeClass
T extends StrangeClass<S,T> declared in class StrangeClass
1 error

Do you think it's a bug or expected behavior?
This post has been answered by gimbal2 on Aug 13 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2012
Added on Aug 12 2012
4 comments
516 views