Skip to content

Commit 8302e42

Browse files
committed
transformer: Avoid duplicate TransformMethod annotations on output classes
1 parent 1799620 commit 8302e42

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/io/github/notstirred/dasm/transformer/Transformer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.github.notstirred.dasm.annotation.parse.AddedParameter;
44
import io.github.notstirred.dasm.annotation.parse.redirects.FieldRedirectImpl;
55
import io.github.notstirred.dasm.annotation.parse.redirects.MethodRedirectImpl;
6+
import io.github.notstirred.dasm.api.annotations.transform.TransformClass;
67
import io.github.notstirred.dasm.api.annotations.transform.Visibility;
78
import io.github.notstirred.dasm.api.provider.MappingsProvider;
89
import io.github.notstirred.dasm.data.ClassMethod;
@@ -45,6 +46,10 @@ public void transform(ClassNode targetClass, ClassTransform transform) throws No
4546
if (transform.srcType().equals(transform.dstType())) { // inplace transform
4647
sourceClass = new ClassNode();
4748
targetClass.accept(sourceClass);
49+
if (sourceClass.invisibleAnnotations != null) {
50+
// Removed or a duplicate would be added
51+
sourceClass.invisibleAnnotations.removeIf(annotation -> annotation.desc.equals(TypeUtil.classToDescriptor(TransformClass.class)));
52+
}
4853
} else {
4954
sourceClass = classNodeProvider.classNode(transform.srcType());
5055
}

0 commit comments

Comments
 (0)