test/tools/javac/generics/6723444/T6723444.java

Mon, 16 Sep 2013 14:13:44 +0200

author
jlahoda
date
Mon, 16 Sep 2013 14:13:44 +0200
changeset 2028
4ce8148ffc4f
parent 1896
44e27378f523
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8021112: Spurious unchecked warning reported by javac
6480588: No way to suppress deprecation warnings when implementing deprecated interface
Summary: Fixing DeferredLintHandler configuration, so lint warnings are reported with correct @SuppressWarnings settings
Reviewed-by: jjg, vromero

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 6723444
     4  *
     5  * @summary javac fails to substitute type variables into a constructor's throws clause
     6  * @author Mark Mahieu
     7  * @compile/fail/ref=T6723444_1.out -Xlint:-options -source 7 -XDrawDiagnostics T6723444.java
     8  * @compile/fail/ref=T6723444_2.out -XDrawDiagnostics T6723444.java
     9  *
    10  */
    11 public class T6723444 {
    13     static class Foo<X extends Throwable> {
    14         Foo() throws X {}
    15     }
    17     <X extends Throwable> T6723444()
    18         throws X {}
    20     <X extends Throwable> T6723444(Foo<X> foo)
    21         throws X {}
    23     <X1 extends Throwable, X2 extends Throwable> T6723444(Foo<X1> foo, int i)
    24         throws X1, X2 {}
    26     public static void main(String[] args) throws Exception {
    28         // the following 8 statements should compile without error
    30         Foo<Exception> exFoo = new Foo<Exception>();
    31         exFoo = new Foo<Exception>() {};
    33         new<Exception> T6723444();
    34         new<Exception> T6723444() {};
    35         new T6723444(exFoo);
    36         new T6723444(exFoo) {};
    37         new<Exception, Exception> T6723444(exFoo, 1);
    38         new<Exception, Exception> T6723444(exFoo, 1) {};
    40         // the remaining statements should all raise an
    41         // unreported exception error
    43         new T6723444(exFoo, 1);
    44         new T6723444(exFoo, 1) {};
    46         Foo<Throwable> thFoo = new Foo<Throwable>();
    47         thFoo = new Foo<Throwable>() {};
    49         new<Throwable> T6723444();
    50         new<Throwable> T6723444() {};
    51         new T6723444(thFoo);
    52         new T6723444(thFoo) {};
    53         new T6723444(thFoo, 1);
    54         new T6723444(thFoo, 1) {};
    55         new<Throwable, Throwable> T6723444(thFoo, 1);
    56         new<Throwable, Throwable> T6723444(thFoo, 1) {};
    57     }
    58 }

mercurial