-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
spotbugs-tests/src/test/java/edu/umd/cs/findbugs/detect/Issue1472Test.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,24 @@ | ||
package edu.umd.cs.findbugs.detect; | ||
|
||
import edu.umd.cs.findbugs.AbstractIntegrationTest; | ||
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcher; | ||
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcherBuilder; | ||
import org.junit.Test; | ||
|
||
import static edu.umd.cs.findbugs.test.CountMatcher.containsExactly; | ||
import static org.junit.Assert.assertThat; | ||
|
||
|
||
/** | ||
* @see <a href="https://github.com/spotbugs/spotbugs/issues/1472">GitHub issue #1472</a> | ||
*/ | ||
public class Issue1472Test extends AbstractIntegrationTest { | ||
@Test | ||
public void test() { | ||
performAnalysis("ghIssues/Issue1472.class"); | ||
BugInstanceMatcher bugTypeMatcher = new BugInstanceMatcherBuilder() | ||
.bugType("SA_LOCAL_SELF_COMPUTATION") | ||
.build(); | ||
assertThat(getBugCollection(), containsExactly(4, bugTypeMatcher)); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ghIssues; | ||
|
||
public class Issue1472 { | ||
int testSA_LOCAL_SELF_COMPUTATION(){ | ||
int flags = 1; | ||
return flags ^ flags; // expeected SA_LOCAL_SELF_COMPUTATION | ||
} | ||
|
||
int testSA_LOCAL_SELF_COMPUTATION1(){ | ||
int flags = 1; | ||
return flags & flags; // expeected SA_LOCAL_SELF_COMPUTATION | ||
} | ||
|
||
int testSA_LOCAL_SELF_COMPUTATION2(){ | ||
int flags = 1; | ||
return flags - flags; // expeected SA_LOCAL_SELF_COMPUTATION | ||
} | ||
|
||
int testSA_LOCAL_SELF_COMPUTATION3(){ | ||
int flags = 1; | ||
return flags | flags; // expeected SA_LOCAL_SELF_COMPUTATION | ||
} | ||
} |