Skip to content

Commit

Permalink
Update to ASM9 API
Browse files Browse the repository at this point in the history
Supports records and sealed classes
  • Loading branch information
PseudoKnight committed Dec 17, 2024
1 parent 03e8507 commit 55c3e49
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.7</version>
<version>9.7.1</version>
</dependency>
<dependency>
<groupId>jline</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ClassMirrorVisitor extends ClassVisitor {
private final ClassMirror.ClassInfo<Object> classInfo;

ClassMirrorVisitor(ClassMirror.ClassInfo<Object> info) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.classInfo = info;
}

Expand Down Expand Up @@ -126,7 +126,7 @@ public FieldVisitor visitField(int access, String name, String desc, String sign
value,
signature
);
return new FieldVisitor(Opcodes.ASM7, super.visitField(access, name, desc, signature, value)) {
return new FieldVisitor(Opcodes.ASM9, super.visitField(access, name, desc, signature, value)) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
final AnnotationMirror annotationMirror = new AnnotationMirror(new ClassReferenceMirror(desc), visible);
Expand Down Expand Up @@ -188,7 +188,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
);
}

return new MethodVisitor(Opcodes.ASM7, super.visitMethod(access, name, desc, signature, exceptions)) {
return new MethodVisitor(Opcodes.ASM9, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
final AnnotationMirror annotationMirror = new AnnotationMirror(new ClassReferenceMirror<>(desc), visible);
Expand Down Expand Up @@ -231,7 +231,7 @@ private static class AnnotationMirrorVisitor extends AnnotationVisitor {
private final AnnotationMirror mirror;

public AnnotationMirrorVisitor(AnnotationVisitor next, AnnotationMirror mirror) {
super(Opcodes.ASM7, next);
super(Opcodes.ASM9, next);
this.mirror = mirror;
}

Expand All @@ -258,7 +258,7 @@ private static class ArrayAnnotationVisitor extends AnnotationVisitor {
private Class<?> type;

public ArrayAnnotationVisitor(String name, AnnotationMirror mirror) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.name = name;
this.mirror = mirror;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private static void setup() {
List<ClassMirror<?>> classes = ClassDiscovery.getDefaultInstance().getKnownClasses(ClassDiscovery.GetClassContainer(CheckOverrides.class));
for(ClassMirror cm : classes) {
Class c = cm.loadClass(CheckOverrides.class.getClassLoader(), false);
if(c.isInterface()) {
if(c.isInterface() || c.isRecord()) {
continue;
}
Set<Method> mm = getPotentiallyOverridingMethods(c);
Expand Down
25 changes: 4 additions & 21 deletions src/main/java/com/laytonsmith/abstraction/entities/MCDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public interface MCDisplay extends MCEntity {

void setViewRange(float range);

public MCTransformation getTransformation();
MCTransformation getTransformation();

public void setTransformation(MCTransformation transformation);
void setTransformation(MCTransformation transformation);

public void setTransformationMatrix(float[] mtrxf);
void setTransformationMatrix(float[] mtrxf);

enum Billboard {
CENTER,
Expand All @@ -70,22 +70,5 @@ enum Billboard {
VERTICAL
}

class Brightness {

final int block;
final int sky;

public Brightness(int block, int sky) {
this.block = block;
this.sky = sky;
}

public int block() {
return this.block;
}

public int sky() {
return this.sky;
}
}
record Brightness(int block, int sky) {}
}

0 comments on commit 55c3e49

Please sign in to comment.