typetools / typetools/checker-framework

In the Resource Leak Checker, should we still ignore certain exception types even when there is an explicit catch block?

Open
#6,264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ResourceLeakChecker
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

When adding the default ignored exception type functionality, in my mind I was primarily thinking about cases where the exceptional edge for the call went directly to the method exit, but not about cases where there is a matching catch block. Right now, for this code, I think the exceptional possibility from the call to method() will be ignored by the RLC:

r = alloc();
try {
  method();
} catch (RuntimeException e) {
  throw e;
}
r.close();

Somehow, the presence of a catch block to me implies that the developer cares more about the possibility of that exception being thrown; so maybe we should not ignore the possibility in the RLC?

Originally discussed by @msridhar in https://github.com/typetools/checker-framework/pull/6242#discussion_r1372041661

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the discussion in pull request #6242 and the Resource Leak Checker behavior for the shown Java example. Determine whether a matching catch block should override default ignored exception types, then document the decision and identify the implementation and regression tests needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.