forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 29
Add ignoreDeadCode option
#633
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
Draft
aosen-xiong
wants to merge
22
commits into
eisop:master
Choose a base branch
from
aosen-xiong:add-not-check-dead-code-option
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.
Draft
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7102456
initial commit for adding notcheckdeadcode option
aosen-xiong bd2e5e7
Merge branch 'master' into add-not-check-dead-code-option
aosen-xiong 58f4773
change option name to ignoreCheckDeadCode
aosen-xiong 1d1c348
add comment for entry point of the option
aosen-xiong 2540cd3
add protect variable of checker option
aosen-xiong 02c69a8
add * make javadoc happy
aosen-xiong a3e4013
Merge branch 'master' into add-not-check-dead-code-option
aosen-xiong 73de62f
add deadbranch test case and skip the test first
aosen-xiong 30638eb
Merge branch 'master' into add-not-check-dead-code-option
aosen-xiong 6392013
Address all comments
aosen-xiong decd355
Rename Junit test file
aosen-xiong f7b1bb5
Use getter and revert access modifier for root
aosen-xiong a93748b
Comment first...
aosen-xiong 1576672
Javadoc
aosen-xiong 3571c39
Merge branch 'master' into add-not-check-dead-code-option
wmdietl fa183ec
Update CHANGELOG.md
wmdietl f678255
Wording
aosen-xiong 2117ffc
Skip the test util we add dead branch analysis
aosen-xiong aff7485
Add test case for normal nullness checker
aosen-xiong 1508ca6
Merge branch 'master' into add-not-check-dead-code-option
aosen-xiong bf1652c
Fixes the test cases
aosen-xiong 85d3a9a
Extra warning
aosen-xiong 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
30 changes: 30 additions & 0 deletions
30
checker/src/test/java/org/checkerframework/checker/test/junit/NullnessDeadBranchTest.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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package org.checkerframework.checker.test.junit; | ||
|
|
||
| import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
| import org.junit.runners.Parameterized; | ||
|
|
||
| import java.io.File; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * JUnit tests for the Nullness checker when -AignoreCheckDeadCode command-line argument is used. | ||
| */ | ||
| public class NullnessDeadBranchTest extends CheckerFrameworkPerDirectoryTest { | ||
| /** | ||
| * Create a NullnessNullMarkedTest. | ||
| * | ||
| * @param testFiles the files containing test code, which will be type-checked | ||
| */ | ||
| public NullnessDeadBranchTest(List<File> testFiles) { | ||
| super( | ||
| testFiles, | ||
| org.checkerframework.checker.nullness.NullnessChecker.class, | ||
| "nullness-deadbranch", | ||
| "-AignoreCheckDeadCode"); | ||
| } | ||
|
|
||
| @Parameterized.Parameters | ||
| public static String[] getTestDirs() { | ||
| return new String[] {"nullness-deadbranch"}; | ||
|
aosen-xiong marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // @skip-test until the bug is fixed | ||
|
aosen-xiong marked this conversation as resolved.
Outdated
|
||
|
|
||
| class DeadBranchNPE { | ||
| void test1() { | ||
| Object obj = null; | ||
| if (true) { | ||
| // :: error: (dereference.of.nullable) | ||
| obj.toString(); | ||
| } else { | ||
| obj.toString(); | ||
| } | ||
| } | ||
|
|
||
| void test2() { | ||
| Object obj = null; | ||
| // :: error: (dereference.of.nullable) | ||
| obj.toString(); | ||
| for (int i = 0; i < 0; i++) { | ||
| obj.toString(); | ||
|
aosen-xiong marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
|
|
||
| void test3() { | ||
| Object obj = null; | ||
| // :: error: (dereference.of.nullable) | ||
| obj.toString(); | ||
| while (obj != null) { | ||
| obj.toString(); | ||
| } | ||
| } | ||
| } | ||
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
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
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.