eclipse-jdt / eclipse-jdt/eclipse.jdt.core

[TWR] AIOOB in compiler.codegen.ExceptionLabel.placeEnd when using try block with resources

Open
#3,258 0 comments 0 reactions 1 assignee Claimed by @srikanth-sankaran View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

Found during code review: This program triggers an AIOOB in `compiler.codegen.ExceptionLabel.placeEnd`

I could observe it all the way back to 4.15, but problem likely goes back much farther back in time:

```
public class X implements AutoCloseable {

public void close() throws Exception {}

public static void foo(String[] args) {

for (String arg : args) {
try (X x = new X()) {
if (args.length < 1) {
System.out.println("if");
break;
} else {
System.out.println("else");
break;
}
} finally {
System.out.println("finally");
break;
}
}
}

public static void main(String[] args) {
foo(new String[] { "Hello", "World" });
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.