-
Notifications
You must be signed in to change notification settings - Fork 421
Add -AresourceLeakIgnoredExceptions option
#6242
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
Merged
msridhar
merged 15 commits into
typetools:master
from
Calvin-L:custom-list-of-ignored-rlc-exceptions
Oct 27, 2023
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e12ffb6
Add a manual note about RuntimeException
Calvin-L 747c86e
Remove fishy modification of static field `ignoredExceptionTypes`
Calvin-L 89b7b3d
Unify isIgnoredExceptionType
Calvin-L af6c777
Add resourceLeakIgnoredExceptions option and test
Calvin-L 6c3d4a5
Describe `-AresourceLeakIgnoredExceptions` in the manual
Calvin-L 25d835a
Improved parsing for `-AresourceLeakIgnoredExceptions`
Calvin-L 7917196
Implement checking for exception names
Calvin-L 89a1872
Cache ignored exceptions to avoid duplicate warnings
Calvin-L 885b136
Allow `? extends T` for "all subtypes of T"
Calvin-L dbc0dad
Add a missing javadoc comment
Calvin-L 5181870
Move "by default" to the start of the ignored exceptions paragraph
Calvin-L 5d93de9
Add a test for `default` in the ignored exceptions list
Calvin-L 9af1d93
Add missing names to the list of ignored exceptions anyway
Calvin-L 0e0fa16
Simplify the syntax for `-AresourceLeakIgnoredExceptions`
Calvin-L d41e33f
Merge branch 'master' into custom-list-of-ignored-rlc-exceptions
Calvin-L 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 hidden or 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 hidden or 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
24 changes: 18 additions & 6 deletions
24
checker/src/main/java/org/checkerframework/checker/resourceleak/ResourceLeakAnalysis.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,24 +1,36 @@ | ||
| package org.checkerframework.checker.resourceleak; | ||
|
|
||
| import javax.lang.model.type.TypeMirror; | ||
| import org.checkerframework.checker.calledmethods.CalledMethodsAnalysis; | ||
| import org.checkerframework.checker.calledmethods.CalledMethodsAnnotatedTypeFactory; | ||
| import org.checkerframework.common.basetype.BaseTypeChecker; | ||
|
|
||
| /** | ||
| * This variant of CFAnalysis extends the set of ignored exception types to include all those | ||
| * ignored by the {@link MustCallConsistencyAnalyzer}. See {@link | ||
| * MustCallConsistencyAnalyzer#ignoredExceptionTypes}. | ||
| * This variant of CFAnalysis extends the set of ignored exception types. | ||
| * | ||
| * @see ResourceLeakChecker#getIgnoredExceptions() | ||
| */ | ||
| public class ResourceLeakAnalysis extends CalledMethodsAnalysis { | ||
|
|
||
| /** | ||
| * The set of exceptions to ignore, cached from {@link | ||
| * ResourceLeakChecker#getIgnoredExceptions()}. | ||
| */ | ||
| private final SetOfTypes ignoredExceptions; | ||
|
|
||
| /** | ||
| * Creates a new {@code CalledMethodsAnalysis}. | ||
| * | ||
| * @param checker the checker | ||
| * @param factory the factory | ||
| */ | ||
| protected ResourceLeakAnalysis( | ||
| BaseTypeChecker checker, CalledMethodsAnnotatedTypeFactory factory) { | ||
| ResourceLeakChecker checker, CalledMethodsAnnotatedTypeFactory factory) { | ||
| super(checker, factory); | ||
| ignoredExceptionTypes.addAll(MustCallConsistencyAnalyzer.ignoredExceptionTypes); | ||
| this.ignoredExceptions = checker.getIgnoredExceptions(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isIgnoredExceptionType(TypeMirror exceptionType) { | ||
| return ignoredExceptions.contains(getTypes(), exceptionType); | ||
| } | ||
| } |
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.