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

Mon, 09 Mar 2009 13:29:06 -0700

author
xdono
date
Mon, 09 Mar 2009 13:29:06 -0700
changeset 229
03bcd66bd8e7
parent 186
09eb1acc9610
child 384
ed31953ca025
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

     1 /*
     2  * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  */
    24 /*
    25  * @test
    26  * @bug 6723444
    27  *
    28  * @summary javac fails to substitute type variables into a constructor's throws clause
    29  * @author Mark Mahieu
    30  * @compile/fail/ref=T6723444.out -XDstdout -XDrawDiagnostics T6723444.java
    31  *
    32  */
    33 public class T6723444 {
    35     static class Foo<X extends Throwable> {
    36         Foo() throws X {}
    37     }
    39     <X extends Throwable> T6723444()
    40         throws X {}
    42     <X extends Throwable> T6723444(Foo<X> foo)
    43         throws X {}
    45     <X1 extends Throwable, X2 extends Throwable> T6723444(Foo<X1> foo, int i)
    46         throws X1, X2 {}
    48     public static void main(String[] args) throws Exception {
    50         // the following 8 statements should compile without error
    52         Foo<Exception> exFoo = new Foo<Exception>();
    53         exFoo = new Foo<Exception>() {};
    55         new<Exception> T6723444();
    56         new<Exception> T6723444() {};
    57         new T6723444(exFoo);
    58         new T6723444(exFoo) {};
    59         new<Exception, Exception> T6723444(exFoo, 1);
    60         new<Exception, Exception> T6723444(exFoo, 1) {};
    62         // the remaining statements should all raise an
    63         // unreported exception error
    65         new T6723444(exFoo, 1);
    66         new T6723444(exFoo, 1) {};
    68         Foo<Throwable> thFoo = new Foo<Throwable>();
    69         thFoo = new Foo<Throwable>() {};
    71         new<Throwable> T6723444();
    72         new<Throwable> T6723444() {};
    73         new T6723444(thFoo);
    74         new T6723444(thFoo) {};
    75         new T6723444(thFoo, 1);
    76         new T6723444(thFoo, 1) {};
    77         new<Throwable, Throwable> T6723444(thFoo, 1);
    78         new<Throwable, Throwable> T6723444(thFoo, 1) {};
    79     }
    80 }

mercurial