Skip to content

Warn about unused declared thrown exceptions in Eclipse #273

Closed
@wilkinsona

Description

@wilkinsona

We have numerous places in Boot where we've declared that an exception is thrown when it isn't or when the exception is a RuntimeException so it doesn't need to be declared. There's a PR that removes them which I am in favour of. I think it would also be nice to try and stop them reappearing. To that end, we could change the Eclipse JDT core preferences. Instead of the following:

org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

We'd use the following:

org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled

The changes above will result in warnings being generated for checked exceptions that are unnecessarily declared as thrown. It won't help with unchecked exceptions.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions