Skip to content

Convert "unreachable catch" problem - #219

Draft
datho7561 wants to merge 3 commits into
eclipse-jdtls:mainfrom
datho7561:unreachable-catch
Draft

Convert "unreachable catch" problem#219
datho7561 wants to merge 3 commits into
eclipse-jdtls:mainfrom
datho7561:unreachable-catch

Conversation

@datho7561

Copy link
Copy Markdown
Contributor

eg.

public class UnreachableCatch {

	static class ExceptionA extends Exception {

	}
	static class ExceptionB extends Exception {
	}

	public static void foo() {
		try {
			if (!true) {
				throw new ExceptionB();
			} else {
				throw new ExceptionA();
			}
		} catch (ExceptionA e1) {

		} catch (ExceptionB | ExceptionA e2) {

		}
	}

}

@datho7561

Copy link
Copy Markdown
Contributor Author

hmm no new passes and I didn't actually notice any differences when running locally. I'll double check it before merging

@datho7561
datho7561 marked this pull request as draft March 24, 2026 20:04
eg.

```java
public class UnreachableCatch {

	static class ExceptionA extends Exception {

	}
	static class ExceptionB extends Exception {
	}

	public static void foo() {
		try {
			if (!true) {
				throw new ExceptionB();
			} else {
				throw new ExceptionA();
			}
		} catch (ExceptionA e1) {

		} catch (ExceptionB | ExceptionA e2) {

		}
	}

}
```

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 and others added 2 commits March 25, 2026 11:39
second type in a group of catch statements subclasses a different one,
but this is not reported by ECJ

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants