Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in code generation for try with resources with the fix for Issue # 934 #1063

Closed
srikanth-sankaran opened this issue May 16, 2023 · 2 comments · Fixed by #1064
Closed
Assignees
Labels
bug Something isn't working regression Something was broken by a previous change
Milestone

Comments

@srikanth-sankaran
Copy link
Contributor

Reported by @iloveeclipse in #934

The fix for #934 causes several Advantest internal tests to fail.

A simple test case here:

import java.io.Closeable;
import java.io.IOException;

public class X {
	public static void main(String[] args) throws IOException {
		try (DummyClosable closable = new DummyClosable()) {
			throw new IOException("OMG!!!");
		} catch (IOException e) {
			throw e;
		}
	}

	static class DummyClosable implements Closeable {
		@Override
		public void close() throws IOException {
			System.out.println("Closed!");
		}
	}
}

Executed with ecj from master it throws IllegalArgumentException:

Closed!
Exception in thread "main" java.lang.IllegalArgumentException: Self-suppression not permitted
	at java.base/java.lang.Throwable.addSuppressed(Throwable.java:1072)
	at X.main(X.java:8)
Caused by: java.io.IOException: OMG!!!
	at X.main(X.java:7)

With commit 2bac9e4 reverted, it prints what is expected to print:

Closed!
Exception in thread "main" java.io.IOException: OMG!!!
	at X.main(X.java:7)
@srikanth-sankaran
Copy link
Contributor Author

Sorry about that! I will for the time being use this issue to revert the change made in #934 and leave that ticket open for a refix in due course.

@srikanth-sankaran srikanth-sankaran self-assigned this May 16, 2023
@iloveeclipse
Copy link
Member

OK, thanks.

@iloveeclipse iloveeclipse added this to the 4.28 M3 milestone May 16, 2023
@iloveeclipse iloveeclipse added bug Something isn't working regression Something was broken by a previous change labels May 16, 2023
srikanth-sankaran added a commit to srikanth-sankaran/eclipse.jdt.core that referenced this issue May 16, 2023
iloveeclipse pushed a commit that referenced this issue May 16, 2023
side effects and results in
#1063
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something was broken by a previous change
Projects
None yet
2 participants