4 Replies Latest reply: Aug 15, 2012 8:03 AM by 955312 RSS

    Code not compiling with java7 but compiling with java6

    955312
      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?