T7160084b.java revision 1421
976N/A/*
2362N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
976N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
976N/A *
976N/A * This code is free software; you can redistribute it and/or modify it
976N/A * under the terms of the GNU General Public License version 2 only, as
976N/A * published by the Free Software Foundation.
976N/A *
976N/A * This code is distributed in the hope that it will be useful, but WITHOUT
976N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
976N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
976N/A * version 2 for more details (a copy is included in the LICENSE file that
976N/A * accompanied this code).
976N/A *
976N/A * You should have received a copy of the GNU General Public License version
976N/A * 2 along with this work; if not, write to the Free Software Foundation,
976N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
976N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
976N/A */
976N/A
976N/A/*
976N/A * @test
976N/A * @bug 7160084
976N/A * @summary javac fails to compile an apparently valid class/interface combination
976N/A */
976N/Apublic class T7160084b {
976N/A
976N/A static int assertionCount = 0;
976N/A
976N/A static void assertTrue(boolean cond) {
976N/A assertionCount++;
976N/A if (!cond) {
976N/A throw new AssertionError();
976N/A }
976N/A }
976N/A
976N/A interface Extras {
976N/A static class Enums {
976N/A static class Component {
976N/A Component() { throw new RuntimeException("oops!"); }
976N/A }
976N/A }
976N/A }
976N/A
976N/A interface Test {
976N/A public class Enums {
976N/A interface Widget {
976N/A enum Component { X, Y };
976N/A }
976N/A
976N/A enum Component implements Widget, Extras {
976N/A Z;
976N/A };
976N/A
976N/A public static void test() {
976N/A assertTrue(Component.values().length == 1);
976N/A }
976N/A }
976N/A }
976N/A
976N/A public static void main(String[] args) {
Test.Enums.test();
assertTrue(assertionCount == 1);
}
}