Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/afterSwitchPatternGeneric.java
Tagir Valeev 6cb3ca0045 [java-inspections] CreateLocalFromUsageFix: remove external annotations
Fixes IDEA-367190 NotNull annotation when creating local variable references library which is not in the project
Also: do not resolve reference for writing to a package

GitOrigin-RevId: 31f996515323e250d487bf9b7d343f101d788907
2025-06-12 16:51:42 +00:00

22 lines
506 B
Java

// "Create local variable 'i'" "true-preview"
class A {
String testPattern() {
BaseInterface<String> i;
return switch (i)
{
case BaseInterface.Record1<String> record1 -> "1";
case BaseInterface.Record2 record2 -> "2";
default -> "3";
};
}
}
sealed interface BaseInterface<T> permits BaseInterface.Record1, BaseInterface.Record2{
final class Record1<T> implements BaseInterface<T> {
}
final class Record2 implements BaseInterface<String> {
}
}