typetools / typetools/checker-framework
missing exceptional edges in CFG for for-each loops
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
For a for-each loop like:
List<String> list = ...;
for (String s: list) {
...
}
The CFG includes the relevant calls to iterator(), hasNext() and next() for the loop. But, the corresponding MethodInvocationNodes for these calls appear inside RegularBlocks rather than ExceptionBlocks. Hence, the possibility of any of these calls throwing an exception is not accounted for. This could lead to checker unsoundness, though I do not immediately have an example of that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CFG construction for enhanced for-each loops and inspect how MethodInvocationNodes for iterator(), hasNext(), and next() are placed in RegularBlocks versus ExceptionBlocks. Verify the behavior with a representative Java for-each example. Done means the CFG accounts for exceptions from these calls and the relevant behavior is covered by tests, if an existing CFG test location can be found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100