Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterArrayInitializer.java
Tagir Valeev 5bd02b55c3 [java-intentions] AddVariableInitializerFix: suggest more suitable initial values instead of null for some types
Fixes IDEA-344453 Intellij should not try to initialize an Optional var with null

GitOrigin-RevId: 8097988bf1335a282138e8d09e350c3a5f65204d
2024-02-02 19:17:55 +00:00

22 lines
467 B
Java

// "Surround with try/catch" "true-preview"
public class ExTest {
public static String maybeThrow(String data) throws Ex {
throw new Ex(data);
}
{
String[] a = null;
try {
a = new String[]{maybeThrow("")};
} catch (Ex e) {
throw new RuntimeException(e);
}
System.out.println(a);
}
private static class Ex extends Exception {
public Ex(String s) {
}
}
}