6663588: Compiler goes into infinite loop for Cyclic Inheritance test case
Summary: interplay between cyclic inheritance and tvar bounds hangs javac
Reviewed-by: jjg
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Mar 04 15:19:06 2008 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Mar 04 15:45:20 2008 +0000
@@ -901,9 +901,9 @@
c.flags_field |= DEPRECATED;
annotateLater(tree.mods.annotations, baseEnv, c);
- attr.attribTypeVariables(tree.typarams, baseEnv);
+ chk.checkNonCyclic(tree.pos(), c.type);
- chk.checkNonCyclic(tree.pos(), c.type);
+ attr.attribTypeVariables(tree.typarams, baseEnv);
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6663588.java Tue Mar 04 15:45:20 2008 +0000
@@ -0,0 +1,34 @@
+/*
+ * 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 6663588
+ * @summary Compiler goes into infinite loop for Cyclic Inheritance test case
+ * @author Maurizio Cimadamore
+ * @compile/fail T6663588.java
+ */
+
+public class T6663588<T extends T6663588.Inner> extends T6663588 {
+ class Inner extends T6663588.Inner {}
+}