mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: capture top level wildcards to avoid missing unhandled exceptions in string templates
GitOrigin-RevId: 5642714ef490655d44331304e0a29b95b4de6c65
This commit is contained in:
committed by
intellij-monorepo-bot
parent
049e116d27
commit
193febffe6
+1
-1
@@ -124,7 +124,7 @@ public final class PsiTemplateExpressionImpl extends ExpressionPsiElement implem
|
||||
for (PsiClassType classType : PsiTypesUtil.getClassTypeComponents(type)) {
|
||||
PsiType substituted = PsiUtil.substituteTypeParameter(classType, CommonClassNames.JAVA_LANG_STRING_TEMPLATE_PROCESSOR, 0, false);
|
||||
if (substituted != null) {
|
||||
return substituted;
|
||||
return PsiUtil.captureToplevelWildcards(substituted, this);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+7
@@ -104,6 +104,13 @@ class X {
|
||||
public static void testCapturedWilcard(StringTemplate.Processor<?, ?> str) {
|
||||
Object s = <error descr="Unhandled exception: java.lang.Throwable">str."";</error>
|
||||
}
|
||||
|
||||
void testCapturedWildcard2() {
|
||||
StringTemplate.Processor<StringTemplate.Processor<?, ? extends Exception>, RuntimeException> processor = null;
|
||||
Object o = <error descr="Unhandled exception: java.lang.Exception">processor."""
|
||||
"""."""
|
||||
""";</error>
|
||||
}
|
||||
|
||||
public static void noNewlineAfterTextBlockOpeningQuotes() {
|
||||
System.out.println(STR.<error descr="Illegal text block start: missing new line after opening quotes">"""</error>\{}""");
|
||||
|
||||
Reference in New Issue
Block a user