Skip to content

Commit

Permalink
update groovy to 4.0.21
Browse files Browse the repository at this point in the history
brachy84 committed May 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ec4b87b commit 448435f
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ modGroup = com.cleanroommc.groovyscript
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 1.0.1
groovy_version = 4.0.13
groovy_version = 4.0.21
debug_use_examples_folder = true
debug_run_ls = false

Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import org.codehaus.groovy.ast.Parameter;
import org.codehaus.groovy.ast.*;
import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.stmt.ReturnStatement;
import org.codehaus.groovy.vmplugin.v8.Java8;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -28,13 +30,6 @@ public abstract class Java8Mixin {
@Shadow
protected abstract ClassNode[] makeClassNodes(CompileUnit cu, Type[] types, Class<?>[] cls);

@Shadow
private static void setMethodDefaultValue(MethodNode mn, Method m) {
}

@Shadow
protected abstract GenericsType[] configureTypeVariable(TypeVariable<?>[] tvs);

@Shadow
protected abstract Annotation[][] getConstructorParameterAnnotations(Constructor<?> constructor);

@@ -47,6 +42,9 @@ private static void setMethodDefaultValue(MethodNode mn, Method m) {
@Shadow
protected abstract void makeRecordComponents(CompileUnit cu, ClassNode classNode, Class<?> clazz);

@Shadow
protected abstract GenericsType[] configureTypeParameters(TypeVariable<?>[] tp);

/**
* @author brachy84
* @reason remapping minecraft fields and methods
@@ -72,10 +70,13 @@ public void configureClassNode(final CompileUnit compileUnit, final ClassNode cl
ClassNode[] exceptions = makeClassNodes(compileUnit, m.getGenericExceptionTypes(), m.getExceptionTypes());
String name = deobfMethods != null ? deobfMethods.getOrDefault(m.getName(), m.getName()) : m.getName();
MethodNode mn = new MethodNode(name, m.getModifiers(), ret, params, exceptions, null);
mn.setSynthetic(m.isSynthetic());
setMethodDefaultValue(mn, m);
setAnnotationMetaData(m.getAnnotations(), mn);
mn.setGenericsTypes(configureTypeVariable(m.getTypeParameters()));
if (true) { // TODO: GROOVY-10862
mn.setAnnotationDefault(true);
mn.setCode(new ReturnStatement(new ConstantExpression(m.getDefaultValue())));
}
mn.setGenericsTypes(configureTypeParameters(m.getTypeParameters()));
mn.setSynthetic(m.isSynthetic());
classNode.addMethod(mn);
}
Constructor<?>[] constructors = clazz.getDeclaredConstructors();

0 comments on commit 448435f

Please sign in to comment.