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

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

mercurial