Skip to content

Commit

Permalink
Merge pull request #1207 from hcoles/feature/annotation_interface
Browse files Browse the repository at this point in the history
allow removal of class annotations
  • Loading branch information
hcoles authored May 12, 2023
2 parents 8b5af8e + f60422a commit 49b2327
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pitest-maven-verification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-entry</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ default AnnotationVisitor createForAnnotation(NoMethodContext context, Annotatio
return null;
}

default boolean skipAnnotation(NoMethodContext nonMethodContext, AnnotationInfo annotationInfo) {
return false;
}

default FieldVisitor createForField(NoMethodContext context, FieldInfo fieldInfo, FieldVisitor fieldVisitor) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ public void visitSource(final String source, final String debug) {

@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
AnnotationVisitor next = super.visitAnnotation(descriptor, visible);
AnnotationInfo annotationInfo = new AnnotationInfo(descriptor, visible);
for (final MethodMutatorFactory each : this.mutators) {
if (each.skipAnnotation(this.nonMethodContext, annotationInfo)) {
return null;
}
}
AnnotationVisitor next = super.visitAnnotation(descriptor, visible);
for (final MethodMutatorFactory each : this.mutators) {
AnnotationVisitor fv = each.createForAnnotation(this.nonMethodContext, annotationInfo, next);
if (fv != null) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
are used for few artifacts -->
<properties>
<!-- this revision number used only for local builds -->
<revision>1.0.0-SNAPSHOT</revision>
<revision>dev-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand Down

0 comments on commit 49b2327

Please sign in to comment.