Skip to content

Commit dc31879

Browse files
committed
Fix double annotation value remapping
There are issues with AsmAnnotationRemapper remapping annotation values twice, the underlying AnnotationRemapper does the value remapping. However, the parent visitor to AnnotationRemapper is an AnnotationRemapper as well, thus making AsmAnnotationRemapper remap once, and the original remapper remap again.
1 parent 5f2b421 commit dc31879

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
sourceCompatibility = JavaVersion.VERSION_1_8
99
targetCompatibility = JavaVersion.VERSION_1_8
1010

11-
version = '0.3.2-architectury.4'
11+
version = '0.3.2-architectury.5'
1212

1313
def ENV = System.getenv()
1414
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")

src/main/java/net/fabricmc/tinyremapper/AsmClassRemapper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, Str
9595
return createAsmAnnotationRemapper(descriptor, super.visitTypeAnnotation(typeRef, typePath, descriptor, visible), remapper);
9696
}
9797

98-
public static AnnotationRemapper createAsmAnnotationRemapper(String desc, AnnotationVisitor annotationVisitor, Remapper remapper) {
98+
public static AnnotationVisitor createAsmAnnotationRemapper(String desc, AnnotationVisitor annotationVisitor, Remapper remapper) {
9999
return annotationVisitor == null ? null : new AsmAnnotationRemapper(annotationVisitor, remapper, desc);
100100
}
101101

@@ -585,9 +585,12 @@ private static boolean isJavaKeyword(String s) {
585585
private final boolean renameInvalidLocals;
586586
}
587587

588-
private static class AsmAnnotationRemapper extends AnnotationRemapper {
588+
private static class AsmAnnotationRemapper extends AnnotationVisitor {
589+
protected final Remapper remapper;
590+
589591
public AsmAnnotationRemapper(AnnotationVisitor annotationVisitor, Remapper remapper, String annotationDesc) {
590-
super(annotationVisitor, remapper);
592+
super(Opcodes.ASM9, annotationVisitor);
593+
this.remapper = remapper;
591594

592595
annotationClass = Type.getType(annotationDesc).getInternalName();
593596
}

0 commit comments

Comments
 (0)