# HG changeset patch # User mcimadamore # Date 1224782951 -3600 # Node ID c6e3fc6dda61189a236ec8c0217abc4b31e38325 # Parent 433ee48257c092b3167450b0f471712830c18f86 6557954: Inner class type parameters doesn't get substituted when checking type well-formedness Summary: Validator.visitTypeApply should substitute all formal typevars with actual parameters Reviewed-by: jjg diff -r 433ee48257c0 -r c6e3fc6dda61 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 23 18:10:23 2008 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 23 18:29:11 2008 +0100 @@ -802,10 +802,10 @@ public void visitTypeApply(JCTypeApply tree) { if (tree.type.tag == CLASS) { - List formals = tree.type.tsym.type.getTypeArguments(); - List actuals = tree.type.getTypeArguments(); + List formals = tree.type.tsym.type.allparams(); + List actuals = tree.type.allparams(); List args = tree.arguments; - List forms = formals; + List forms = tree.type.tsym.type.getTypeArguments(); ListBuffer tvars_buf = new ListBuffer(); // For matching pairs of actual argument types `a' and @@ -828,7 +828,7 @@ args = tree.arguments; List tvars_cap = types.substBounds(formals, formals, - types.capture(tree.type).getTypeArguments()); + types.capture(tree.type).allparams()); while (args.nonEmpty() && tvars_cap.nonEmpty()) { // Let the actual arguments know their bound args.head.type.withTypeVar((TypeVar)tvars_cap.head); diff -r 433ee48257c0 -r c6e3fc6dda61 test/tools/javac/generics/T6557954.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/T6557954.java Thu Oct 23 18:29:11 2008 +0100 @@ -0,0 +1,36 @@ +/* + * 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 6557954 + * @summary Inner class type parameters doesn't get substituted when checking type well-formedness + * @author Maurizio Cimadamore + * + * @compile T6557954.java + */ + +class T6557954 { + class Foo {} + T6557954.Foo f; +} \ No newline at end of file