Skip to content

Commit 661f37a

Browse files
committed
revert performance regression
Filters still required for interfaces due to default and static methods
1 parent 11f368d commit 661f37a

File tree

4 files changed

+6
-28
lines changed

4 files changed

+6
-28
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.pitest.bytecode.analysis.OpcodeMatchers.POP2;
99

1010
import java.util.Collection;
11+
import java.util.Collections;
1112
import java.util.List;
1213
import java.util.Optional;
1314
import java.util.function.Predicate;
@@ -62,12 +63,6 @@ public void begin(ClassTree clazz) {
6263
public Collection<MutationDetails> intercept(
6364
Collection<MutationDetails> mutations, Mutater m) {
6465

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-
7166
final List<MutationDetails> doNotTouch = mutations.stream()
7267
.filter(inEqualsMethod().negate())
7368
.collect(Collectors.toList());
@@ -101,7 +96,7 @@ private Predicate<MutationDetails> isShortcutEquals(final MethodTree tree, final
10196

10297
private boolean shortCutEquals(MethodTree tree, MutationDetails a, Mutater m) {
10398
if (tree.instructions().isEmpty()) {
104-
Log.getLogger().warning(tree.asLocation() + " has no instructions");
99+
// occurs for mutations to annotations on interfaces
105100
return false;
106101
}
107102

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ public void begin(ClassTree clazz) {
185185
public Collection<MutationDetails> intercept(
186186
Collection<MutationDetails> mutations, Mutater m) {
187187

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-
194188
return mutations.stream().filter(mutatesIteratorLoopPlumbing().negate())
195189
.collect(Collectors.toList());
196190
}
@@ -205,7 +199,7 @@ private Predicate<MutationDetails> mutatesIteratorLoopPlumbing() {
205199
MethodTree method = maybeMethod.get();
206200

207201
if (method.instructions().isEmpty()) {
208-
Log.getLogger().warning(method.asLocation() + " has no instructions");
202+
// occurs for mutations to annotations on interfaces
209203
return false;
210204
}
211205

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.pitest.sequence.Result.result;
2222

2323
import java.util.Collection;
24+
import java.util.Collections;
2425
import java.util.IdentityHashMap;
2526
import java.util.Map;
2627
import java.util.Optional;
@@ -153,12 +154,6 @@ public void begin(ClassTree clazz) {
153154
public Collection<MutationDetails> intercept(
154155
Collection<MutationDetails> mutations, Mutater m) {
155156

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-
162157
return mutations.stream()
163158
.filter(mutatesAForLoopCounter().negate())
164159
.collect(Collectors.toList());
@@ -173,7 +168,7 @@ private Predicate<MutationDetails> mutatesAForLoopCounter() {
173168
}
174169
MethodTree method = maybeMethod.get();
175170
if (method.instructions().isEmpty()) {
176-
Log.getLogger().warning(method.asLocation() + " has no instructions");
171+
// occurs for mutations to annotations on interfaces
177172
return false;
178173
}
179174

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ public void begin(ClassTree clazz) {
4444
public Collection<MutationDetails> intercept(
4545
Collection<MutationDetails> mutations, Mutater m) {
4646

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-
5347
final Map<Location,Collection<MutationDetails>> buckets = FCollection.bucket(mutations, mutationToLocation());
5448

5549
final List<MutationDetails> willTimeout = new ArrayList<>();
@@ -69,7 +63,7 @@ private Collection<MutationDetails> findTimeoutMutants(Location location,
6963
}
7064
MethodTree method = maybeMethod.get();
7165
if (method.instructions().isEmpty()) {
72-
Log.getLogger().warning(method.asLocation() + " has no instructions");
66+
// occurs for mutations to annotations on interfaces
7367
return Collections.emptyList();
7468
}
7569

0 commit comments

Comments
 (0)