-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@CreatesMustCallFor create an obligation on exceptional successors #6221
Open
Nargeshdb
wants to merge
45
commits into
typetools:master
Choose a base branch
from
Nargeshdb:FN-CreatesMustCallFor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
30fda21
update
Nargeshdb 79d248d
update
Nargeshdb b5e6f13
fix the 6050 issue
Nargeshdb 120fbca
update
Nargeshdb c940e76
fix
Nargeshdb 663fde3
Merge remote-tracking branch 'origin' into FN-CreatesMustCallFor
Nargeshdb 24fcd0b
add doc
Nargeshdb 3f41584
update
Nargeshdb 8d28581
trying to repro Daikon failure
msridhar 5da7fc5
Merge remote-tracking branch 'origin' into FN-CreatesMustCallFor
Nargeshdb 89ff874
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb 4f0aa0f
add a test to repo the issue
Nargeshdb bab4bc8
repo the issue
Nargeshdb b12962a
Merge remote-tracking branch 'origin/master' into FN-CreatesMustCallFor
smillst 9d82755
Use util method.
smillst 8a832d3
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb 937af32
reformat
Nargeshdb 535ae4e
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb bf3f775
revert changes
Nargeshdb 9bcc73c
remove extra test
Nargeshdb 13b080d
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb 2c93562
reformat
Nargeshdb 7f5a8a1
check declared exception types
Nargeshdb 8282b7c
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb 66da755
check delared exception types
Nargeshdb 647d669
fix
Nargeshdb c3674df
Merge remote-tracking branch 'origin' into FN-CreatesMustCallFor
Nargeshdb 9a5a614
ignored exception in mc-typefactory
Nargeshdb 74cbcef
Merge branch 'master' into FN-CreatesMustCallFor
msridhar 1775f25
updates names and adds comments
Nargeshdb 146c5a2
move computations in #6242 to MustCallChecker
Nargeshdb 428692d
merge
Nargeshdb 3949fc4
make MustCallAnalysis consistent with 6242
Nargeshdb 076c498
fix
Nargeshdb e3a9b56
fix misc error
Nargeshdb 8ed9422
minor fix
Nargeshdb c2471a7
update
Nargeshdb c1c5384
Merge branch 'master' into FN-CreatesMustCallFor
Nargeshdb 13a9333
refactor
Nargeshdb e2883b9
Merge remote-tracking branch 'origin/FN-CreatesMustCallFor' into FN-C…
Nargeshdb 37c45b9
Merge branch 'master' into FN-CreatesMustCallFor
msridhar 1974e25
javadoc
msridhar 4430d05
Merge branch 'master' into FN-CreatesMustCallFor
msridhar ee8edbd
Merge branch 'master' into FN-CreatesMustCallFor
msridhar 04ec201
Merge branch 'master' into FN-CreatesMustCallFor
msridhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
checker/src/main/java/org/checkerframework/checker/mustcall/MustCallAnalysis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.checkerframework.checker.mustcall; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
import com.sun.tools.javac.code.Type; | ||
import java.util.Set; | ||
import javax.lang.model.type.TypeMirror; | ||
import org.checkerframework.checker.signature.qual.CanonicalName; | ||
import org.checkerframework.framework.flow.CFAnalysis; | ||
|
||
/** | ||
* The analysis for the Must Call Checker. The analysis is specialized to ignore certain exception | ||
* types; see {@link #isIgnoredExceptionType(TypeMirror)}. | ||
*/ | ||
public class MustCallAnalysis extends CFAnalysis { | ||
|
||
/** | ||
* Constructs an MustCallAnalysis. | ||
* | ||
* @param checker the checker | ||
* @param factory the type factory | ||
*/ | ||
public MustCallAnalysis(MustCallChecker checker, MustCallAnnotatedTypeFactory factory) { | ||
super(checker, factory); | ||
} | ||
|
||
/** | ||
* The fully-qualified names of the exception types that are ignored by this checker when | ||
* computing dataflow stores. | ||
*/ | ||
protected static final Set<@CanonicalName String> ignoredExceptionTypes = | ||
ImmutableSet.of( | ||
// Use the Nullness Checker instead. | ||
NullPointerException.class.getCanonicalName(), | ||
// Ignore run-time errors, which cannot be predicted statically. Doing | ||
// so is unsound in the sense that they could still occur - e.g., the | ||
// program could run out of memory - but if they did, the checker's | ||
// results would be useless anyway. | ||
Error.class.getCanonicalName(), | ||
RuntimeException.class.getCanonicalName()); | ||
|
||
@Override | ||
public boolean isIgnoredExceptionType(TypeMirror exceptionType) { | ||
return ignoredExceptionTypes.contains( | ||
((Type) exceptionType).tsym.getQualifiedName().toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nargeshdb my question remains, shouldn't this set of exceptions be configurable using the same setting added in #6242?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relatedly, #6242 added a mechanism for matching all subtypes of an exception type in addition to matching by name. We should try to be as consistent as possible here and share code if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nargeshdb any thoughts on the above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already addressed your comment here. There is a method in this class like what we have here, but it's overridden in MustCallAnnotatedTypeFactory to match all subtypes of an exception type. Is there anything else that I missed regarding consistency with 6242?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being unclear. #6242 added an option
-AresourceLeakIgnoredExceptions
to specify which exception types should be ignored by the RLC. This PR moves some of that logic to the Must Call Checker. And, as far as I can see, the method in this class,MustCallAnalysis
, ignored the setting entirely. This is similar to what is done in theCalledMethodsAnalysis
, I agree. What I don't fully understand is:MustCallAnalysis#isIgnoredExceptionType()
? Was this an oversight from before and it should have been there all along? This method seems unrelated to the command line setting.Thanks a lot!