-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1345 from hcoles/feature/improved_delayed_execution
Feature/improved delayed execution
- Loading branch information
Showing
23 changed files
with
691 additions
and
56 deletions.
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
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
30 changes: 30 additions & 0 deletions
30
...rg/pitest/mutationtest/build/intercept/staticinitializers/FunctionalInterfaceScanner.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,30 @@ | ||
package org.pitest.mutationtest.build.intercept.staticinitializers; | ||
|
||
import org.objectweb.asm.tree.AnnotationNode; | ||
import org.pitest.bytecode.analysis.ClassTree; | ||
import org.pitest.classpath.CodeSource; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
|
||
public class FunctionalInterfaceScanner implements Function<CodeSource, Set<String>> { | ||
@Override | ||
public Set<String> apply(CodeSource codeSource) { | ||
return codeSource.codeTrees() | ||
.filter(this::isFunctionalInterface) | ||
.map(c -> c.rawNode().name) | ||
.collect(Collectors.toSet()); | ||
} | ||
|
||
private boolean isFunctionalInterface(ClassTree classTree) { | ||
List<AnnotationNode> annotations = classTree.rawNode().visibleAnnotations; | ||
if (annotations == null) { | ||
return false; | ||
} | ||
|
||
return annotations.stream() | ||
.anyMatch(a -> a.desc.equals("Ljava/lang/FunctionalInterface;")); | ||
} | ||
} |
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
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
Oops, something went wrong.