-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore control flow due to NullPointerExceptions in Called Methods Ch…
…ecker
- Loading branch information
Showing
10 changed files
with
120 additions
and
20 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
checker/src/main/java/org/checkerframework/checker/calledmethods/CalledMethodsAnalysis.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,40 @@ | ||
package org.checkerframework.checker.calledmethods; | ||
|
||
import com.sun.tools.javac.code.Type; | ||
import javax.lang.model.type.TypeMirror; | ||
import org.checkerframework.common.basetype.BaseTypeChecker; | ||
import org.checkerframework.framework.flow.CFAnalysis; | ||
|
||
/** | ||
* The analysis for the Called Methods Checker. The analysis is specialized to ignore certain | ||
* exception types; see {@link #isIgnoredExceptionType(TypeMirror)}. | ||
*/ | ||
public class CalledMethodsAnalysis extends CFAnalysis { | ||
|
||
/** | ||
* Creates a new {@code CalledMethodsAnalysis}. | ||
* | ||
* @param checker the checker | ||
* @param factory the factory | ||
*/ | ||
protected CalledMethodsAnalysis( | ||
BaseTypeChecker checker, CalledMethodsAnnotatedTypeFactory factory) { | ||
super(checker, factory); | ||
} | ||
|
||
/** | ||
* Ignore exceptional control flow due to {@code NullPointerException}s, as this checker assumes | ||
* the Nullness Checker will be used to prevent such exceptions. | ||
* | ||
* @param exceptionType exception type | ||
* @return {@code true} if {@code exceptionType} is {@code NullPointerException}, {@code false} | ||
* otherwise | ||
*/ | ||
@Override | ||
protected boolean isIgnoredExceptionType(TypeMirror exceptionType) { | ||
return ((Type) exceptionType) | ||
.tsym | ||
.getQualifiedName() | ||
.contentEquals("java.lang.NullPointerException"); | ||
} | ||
} |
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
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
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
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
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