Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterTryWithResources.java
Tagir Valeev 9c6aeba5b4 [java] More tests for preview; minor fixes
GitOrigin-RevId: 7f72c5f68ab821e728eb0d5152f0910f48035046
2022-07-22 11:54:00 +00:00

31 lines
641 B
Java

// "Assert 'foo != null'" "true-preview"
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
class X {
class Foo implements AutoCloseable {
public void close() {}
}
class Bar implements AutoCloseable {
Bar(@NotNull Foo foo) {}
public void close() {}
}
native @Nullable Foo getFoo();
void test() {
try (Foo foo = getFoo()) {
assert foo != null;
try (Bar bar = new Bar(foo))
{
System.out.println(bar);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
System.out.println("exiting");
}
}
}