langtools/test/tools/javac/generics/SelfImplement.java
author sogoel
Fri, 15 May 2015 16:53:42 -0700
changeset 30721 1024d425d97e
parent 30719 91834c070ba5
permissions -rw-r--r--
8074425: Group 13b: golden files for tests in tools/javac/generics dir Reviewed-by: jjg, darcy, mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
30719
91834c070ba5 8074417: Group 13a: golden files for tests in tools/javac/generics dir
sogoel
parents: 5520
diff changeset
     2
 * @test /nodynamiccopyright/
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4725668
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary generics: reject implementation with incorrect return type
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author gafter
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 *
30719
91834c070ba5 8074417: Group 13a: golden files for tests in tools/javac/generics dir
sogoel
parents: 5520
diff changeset
     7
 * @compile/fail/ref=SelfImplement.out -XDrawDiagnostics   SelfImplement.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
class SelfImplement {
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
    static abstract class A<T> {
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
        abstract void f(T t);
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
        public int f(Integer t) { return 3; }
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
    static abstract class B extends A<Integer> {
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
        // error: A<Integer>.f(Integer) returning int can't implement
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
        //        A<Integer>.f(Integer) returning void.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
}