Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5044646

package-private indirect noninherited generic overriders

XMLWordPrintable

    • b03
    • generic
    • solaris_8
    • Verified

      Is the compiler right or wrong here?


      ==========$ cat -n A1.java
           1 package p1;
           2
           3 public class A1<T> {
           4 int f(T t) { return 0; }
           5 }
      ==========$ cat -n A2.java
           1 package p2;
           2
           3 public class A2<T> extends p1.A1<T> {}
      ==========$ cat -n B.java
           1 package p1;
           2
           3 public abstract class B<T,U> extends p2.A2<U> {
           4 abstract int f(T t);
           5 // abstract I2 f(String s);
           6 }
      ==========$ cat -n C.java
           1 package p1;
           2
           3 public class C extends B<String,String> {
           4 // indirect overrider f(String) from A1
           5 }
      ==========$ newjavac *.java
      C.java:3: p1.C is not abstract and does not override abstract method f(java.lang.String) in p1.B
      public class C extends B<String,String> {
             ^
      1 error
      ==========$

            ahe Peter Ahe
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: