Skip to content

Commit dc12678

Browse files
authored
Merge pull request #1427 from hcoles/feature/avoid_empty_method_warnings
disable filters with empty method checks for interfaces
2 parents 6e17a6e + 59272ee commit dc12678

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/equivalent/EqualsPerformanceShortcutFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ public void begin(ClassTree clazz) {
6161
@Override
6262
public Collection<MutationDetails> intercept(
6363
Collection<MutationDetails> mutations, Mutater m) {
64+
65+
// skip for mutations to annotations on interfaces
66+
// to avoid generating empty method warnings.
67+
if (this.currentClass.isInterface()) {
68+
return mutations;
69+
}
70+
6471
final List<MutationDetails> doNotTouch = mutations.stream()
6572
.filter(inEqualsMethod().negate())
6673
.collect(Collectors.toList());

pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/javafeatures/ForEachLoopFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ public void begin(ClassTree clazz) {
184184
@Override
185185
public Collection<MutationDetails> intercept(
186186
Collection<MutationDetails> mutations, Mutater m) {
187+
188+
// skip for mutations to annotations on interfaces
189+
// to avoid generating empty method warnings.
190+
if (this.currentClass.isInterface()) {
191+
return mutations;
192+
}
193+
187194
return mutations.stream().filter(mutatesIteratorLoopPlumbing().negate())
188195
.collect(Collectors.toList());
189196
}

pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/timeout/AvoidForLoopCounterFilter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import org.pitest.util.Log;
5050

5151
/**
52-
* Removes mutants that affect for loop counters as these have
52+
* Removes mutants that effect for loop counters as these have
5353
* a high chance of timing out.
5454
*/
5555
public class AvoidForLoopCounterFilter implements MutationInterceptor {
@@ -152,6 +152,13 @@ public void begin(ClassTree clazz) {
152152
@Override
153153
public Collection<MutationDetails> intercept(
154154
Collection<MutationDetails> mutations, Mutater m) {
155+
156+
// skip for mutations to annotations on interfaces
157+
// to avoid generating empty method warnings.
158+
if (this.currentClass.isInterface()) {
159+
return mutations;
160+
}
161+
155162
return mutations.stream()
156163
.filter(mutatesAForLoopCounter().negate())
157164
.collect(Collectors.toList());

pitest-entry/src/main/java/org/pitest/mutationtest/build/intercept/timeout/InfiniteLoopFilter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public void begin(ClassTree clazz) {
4343
@Override
4444
public Collection<MutationDetails> intercept(
4545
Collection<MutationDetails> mutations, Mutater m) {
46+
47+
// skip for mutations to annotations on interfaces
48+
// to avoid generating empty method warnings.
49+
if (this.currentClass.isInterface()) {
50+
return mutations;
51+
}
52+
4653
final Map<Location,Collection<MutationDetails>> buckets = FCollection.bucket(mutations, mutationToLocation());
4754

4855
final List<MutationDetails> willTimeout = new ArrayList<>();

0 commit comments

Comments
 (0)