Skip to content

Commit dbdbc92

Browse files
committed
test: issue spotbugs#2837 reproducer
1 parent c9cb518 commit dbdbc92

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package edu.umd.cs.findbugs.detect;
2+
3+
import edu.umd.cs.findbugs.AbstractIntegrationTest;
4+
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcher;
5+
import edu.umd.cs.findbugs.test.matcher.BugInstanceMatcherBuilder;
6+
import org.junit.jupiter.api.Test;
7+
8+
import static edu.umd.cs.findbugs.test.CountMatcher.containsExactly;
9+
import static org.hamcrest.MatcherAssert.assertThat;
10+
11+
12+
class Issue2837Test extends AbstractIntegrationTest {
13+
14+
@Test
15+
void testIssue() {
16+
performAnalysis("ghIssues/Issue2837.class");
17+
BugInstanceMatcher matcher = new BugInstanceMatcherBuilder()
18+
.bugType("MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR")
19+
.build();
20+
21+
assertThat(getBugCollection(), containsExactly(0, matcher));
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ghIssues;
2+
3+
import java.util.function.Predicate;
4+
5+
public class Issue2837 {
6+
public boolean overridable(String s) {
7+
return true;
8+
}
9+
10+
public final Predicate<String> predicate1 = this::overridable;
11+
}

0 commit comments

Comments
 (0)