You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(final String[] args) throws Exception {
try(final InputStream in = Files.newInputStream(Path.of("Main.java"))) {
System.out.println("Hello, World!");
throw new Exception("test");
}
}
}
[step 2]
execute in vscode
Current Result
Hello, World!
Exception in thread "main" java.lang.IllegalArgumentException: Self-suppression not permitted
at java.base/java.lang.Throwable.addSuppressed(Throwable.java:1072)
at Main.main(Main.java:10)
Caused by: java.lang.Exception: test
at Main.main(Main.java:9)
Expected Result
Hello, World!
Exception in thread "main" java.lang.Exception: test
at Main.main(Main.java:9)
Additional Informations
The text was updated successfully, but these errors were encountered:
The Try With Resources result in throwing bad exception type.
Environment
Steps To Reproduce
Create a Main.java file
execute in vscode
Current Result
Expected Result
Additional Informations
The text was updated successfully, but these errors were encountered: