diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 5836f11f6b3..de1453e8ea9 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2664,7 +2664,7 @@ public class Attr extends JCTree.Visitor { // Enums may not be extended by source-level classes if (st.tsym != null && ((st.tsym.flags_field & Flags.ENUM) != 0) && - ((c.flags_field & Flags.ENUM) == 0) && + ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0) && !target.compilerBootstrap(c)) { log.error(env.tree.pos(), "enum.types.not.extensible"); } diff --git a/langtools/test/tools/javac/enum/T6675483.java b/langtools/test/tools/javac/enum/T6675483.java new file mode 100644 index 00000000000..2c68d0dd84f --- /dev/null +++ b/langtools/test/tools/javac/enum/T6675483.java @@ -0,0 +1,40 @@ +/* + * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6675483 + * + * @summary Javac rejects multiple type-variable bound declarations starting with an enum type + * @author Maurizio Cimadamore + * + * @compile T6675483.java + */ + +public class T6675483 { + enum E implements Comparable {} + + interface C> { + > void m(); + } +}