langtools/test/tools/javac/OverrideChecks/6199153/T6199153.java
author mcimadamore
Tue, 11 Aug 2009 01:14:31 +0100
changeset 3560 bbfccbd92afe
child 3766 7e2df99e9223
permissions -rw-r--r--
6199153: Generic throws and overriding Summary: javac incorrectly rejects an uchecked overriding Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3560
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     1
/*
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     4
 *
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     8
 *
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    14
 *
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    18
 *
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    21
 * have any questions.
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    22
 */
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    23
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    24
/**
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    25
 * @test
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    26
 * @bug 6199153
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    27
 * @summary Generic throws and overriding
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    28
 * @author  mcimadamore
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    29
 * @compile/fail/ref=T6199153.out -Xlint -Werror -XDrawDiagnostics T6199153.java
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    30
 */
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    31
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    32
import java.io.IOException;
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    33
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    34
class T6199153 {
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    35
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    36
    static class A {
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    37
        public <T extends IOException> void m() throws T {}
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    38
    }
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    39
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    40
    static class B extends A {
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    41
        public void m() throws IOException {}
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    42
    }
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    43
}
bbfccbd92afe 6199153: Generic throws and overriding
mcimadamore
parents:
diff changeset
    44