diff --git a/gradle.properties b/gradle.properties index 4fd396ddf..4e7653807 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java index 326e208d1..15f631f84 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java @@ -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();