-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix asm remapper to actually work properly, add to tests
- Loading branch information
1 parent
b7a7ba9
commit 53119d1
Showing
11 changed files
with
201 additions
and
9 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
19 changes: 19 additions & 0 deletions
19
expect-platform-test/src/a/java/xyz/wagyourtail/ept/a/Env.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,19 @@ | ||
package xyz.wagyourtail.ept.a; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) | ||
public @interface Env { | ||
|
||
EnvType value(); | ||
|
||
enum EnvType { | ||
CLIENT, | ||
SERVER, | ||
JOINED | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
expect-platform-test/src/b/java/xyz/wagyourtail/ept/b/OnlyIn.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,20 @@ | ||
package xyz.wagyourtail.ept.b; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) | ||
public @interface OnlyIn { | ||
|
||
Type env(); | ||
|
||
enum Type { | ||
CLIENT, | ||
SERVER, | ||
COMBINED | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
expect-platform-test/src/c/java/xyz/wagyourtail/ept/c/Environment.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,19 @@ | ||
package xyz.wagyourtail.ept.c; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) | ||
public @interface Environment { | ||
|
||
EnvType type(); | ||
|
||
enum EnvType { | ||
CLIENT, | ||
SERVER, | ||
COMBINED | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
src/shared/java/xyz/wagyourtail/unimined/expect/BetterClassRemapper.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,43 @@ | ||
package xyz.wagyourtail.unimined.expect; | ||
|
||
import org.objectweb.asm.*; | ||
import org.objectweb.asm.commons.*; | ||
|
||
public class BetterClassRemapper extends ClassRemapper { | ||
|
||
public BetterClassRemapper(ClassVisitor classVisitor, Remapper remapper) { | ||
super(classVisitor, remapper); | ||
} | ||
|
||
@Override | ||
protected AnnotationVisitor createAnnotationRemapper(String descriptor, AnnotationVisitor annotationVisitor) { | ||
return new AnnotationRemapper(api, Type.getType(descriptor).getInternalName(), annotationVisitor, remapper) { | ||
@Override | ||
public void visitEnum(String name, String descriptor, String value) { | ||
super.visitEnum(name, descriptor, remapper.mapFieldName(Type.getType(descriptor).getInternalName(), value, descriptor)); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
protected MethodVisitor createMethodRemapper(MethodVisitor methodVisitor) { | ||
return new MethodRemapper(api, methodVisitor, remapper) { | ||
|
||
@Override | ||
protected AnnotationVisitor createAnnotationRemapper(String descriptor, AnnotationVisitor annotationVisitor) { | ||
return BetterClassRemapper.this.createAnnotationRemapper(descriptor, annotationVisitor); | ||
} | ||
|
||
}; | ||
} | ||
|
||
@Override | ||
protected FieldVisitor createFieldRemapper(FieldVisitor fieldVisitor) { | ||
return new FieldRemapper(api, fieldVisitor, remapper) { | ||
@Override | ||
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { | ||
return BetterClassRemapper.this.createAnnotationRemapper(descriptor, super.visitAnnotation(descriptor, visible)); | ||
} | ||
}; | ||
} | ||
} |
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