Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow removal of class annotations #1207

Merged
merged 1 commit into from
May 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
allow removal of class annotations
hcoles committed May 12, 2023
commit f60422a2c923674af783b28a1a8d357b4c46d789
2 changes: 1 addition & 1 deletion pitest-maven-verification/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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) {
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -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>