typetools / typetools/checker-framework
`@CreatesMustCallFor` should also create an obligation on exceptional successors
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Test written by @kelloggm:
import java.net.*;
public class BindFail {
public void test() throws Exception {
// :: error: required.method.not.called
Socket s = new Socket();
SocketAddress addr = new InetSocketAddress("127.0.0.1", 6010);
try {
s.bind(addr);
} catch(Exception e) {
// socket might still be open on this path
return;
}
s.close();
}
}
Socket.bind may open a file descriptor even when it throws an exception; see here. It seems that in general, with @CreatesMustCallFor, we cannot be sure if the method creates the obligation before or after it throws an exception. So, for soundness, we should always create obligations on both normal and exceptional successors.
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 with the BindFail test and its expected required.method.not.called diagnostic. Trace how @CreatesMustCallFor is handled for Socket.bind and how obligations are propagated to exceptional successors. Done means the shown exceptional path is diagnosed while the normal path remains checked.
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