forked from spotbugs/spotbugs
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
b5c5cb1
commit 1708c26
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
spotbugs-tests/src/test/java/edu/umd/cs/findbugs/detect/ResolveMethodReferencesTest.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,32 @@ | ||
package edu.umd.cs.findbugs.detect; | ||
|
||
import edu.umd.cs.findbugs.BugCollection; | ||
import edu.umd.cs.findbugs.SortedBugCollection; | ||
import edu.umd.cs.findbugs.test.SpotBugsRule; | ||
import org.hamcrest.Matchers; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
import java.nio.file.Paths; | ||
|
||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.hamcrest.collection.IsEmptyIterable.emptyIterable; | ||
import static org.hamcrest.core.Is.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public class ResolveMethodReferencesTest { | ||
@Rule | ||
public SpotBugsRule spotbugs = new SpotBugsRule(); | ||
|
||
/** | ||
* @see <a href="https://github.com/spotbugs/spotbugs/issues/338">GitHub | ||
* issue</a> | ||
*/ | ||
@Test | ||
public void testIssue338() { | ||
BugCollection bugCollection = spotbugs.performAnalysis(Paths.get("../spotbugsTestCases/build/classes/java/main/lambdas/Issue338.class")); | ||
assertThat(bugCollection, is(emptyIterable())); | ||
assertThat(bugCollection, instanceOf(SortedBugCollection.class)); | ||
assertThat(((SortedBugCollection) bugCollection).missingClassIterator().hasNext(), is(false)); | ||
} | ||
} |
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,17 @@ | ||
package lambdas; | ||
|
||
public class Issue338 { | ||
|
||
public static void main(String[] args) { | ||
Runnable a = System.err::println; | ||
Runnable b = () -> { | ||
if (System.getenv("SOME_RANDOM_VAR") == null) { | ||
a.run(); | ||
} | ||
a.run(); | ||
}; | ||
a.run(); | ||
b.run(); | ||
} | ||
|
||
} |