8312814: Compiler crash when template processor type is a captured wildcard
Reviewed-by: jlahoda, mcimadamore, vromero
This commit is contained in:
parent
9b55e9a706
commit
f14245b388
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/langtools/tools/javac/template
@ -838,6 +838,7 @@ public class TransTypes extends TreeTranslator {
|
||||
}
|
||||
|
||||
public void visitStringTemplate(JCStringTemplate tree) {
|
||||
tree.processor = translate(tree.processor, erasure(tree.processor.type));
|
||||
tree.expressions = tree.expressions.stream()
|
||||
.map(e -> translate(e, erasure(e.type))).collect(List.collector());
|
||||
tree.type = erasure(tree.type);
|
||||
|
39
test/langtools/tools/javac/template/T8312814.java
Normal file
39
test/langtools/tools/javac/template/T8312814.java
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test T8312814
|
||||
* @summary Verify proper behavior of TransType w.r.t. templated Strings
|
||||
* @enablePreview
|
||||
* @compile T8312814.java
|
||||
*/
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class T8312814 {
|
||||
void x(List<? extends StringTemplate.Processor<String, RuntimeException>> list) {
|
||||
list.get(0)."";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user