提交 feb70bd2 编写于 作者: M mcimadamore

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
上级 588e7733
......@@ -802,10 +802,10 @@ public class Check {
public void visitTypeApply(JCTypeApply tree) {
if (tree.type.tag == CLASS) {
List<Type> formals = tree.type.tsym.type.getTypeArguments();
List<Type> actuals = tree.type.getTypeArguments();
List<Type> formals = tree.type.tsym.type.allparams();
List<Type> actuals = tree.type.allparams();
List<JCExpression> args = tree.arguments;
List<Type> forms = formals;
List<Type> forms = tree.type.tsym.type.getTypeArguments();
ListBuffer<TypeVar> tvars_buf = new ListBuffer<TypeVar>();
// For matching pairs of actual argument types `a' and
......@@ -828,7 +828,7 @@ public class Check {
args = tree.arguments;
List<Type> 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);
......
/*
* 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<T> {
class Foo<U extends T> {}
T6557954<Number>.Foo<Integer> f;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册