This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit ccb554bfc717d4d9f5be91dd639395e2261ce618 Author: Eric Milles <[email protected]> AuthorDate: Sat Feb 28 11:33:02 2026 -0600 replace deprecated references --- .../codehaus/groovy/runtime/callsite/CallSiteGenerator.java | 8 ++++++-- src/main/java/org/codehaus/groovy/tools/DgmConverter.java | 13 +++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteGenerator.java b/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteGenerator.java index 2dc9f45fd6..e91e51387d 100644 --- a/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteGenerator.java +++ b/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteGenerator.java @@ -20,6 +20,7 @@ package org.codehaus.groovy.runtime.callsite; import org.codehaus.groovy.classgen.GeneratorContext; import org.codehaus.groovy.classgen.asm.BytecodeHelper; +import org.codehaus.groovy.classgen.asm.util.TypeUtil; import org.codehaus.groovy.control.CompilerConfiguration; import org.codehaus.groovy.reflection.CachedClass; import org.codehaus.groovy.reflection.CachedMethod; @@ -89,9 +90,12 @@ public class CallSiteGenerator { mv.visitMethodInsn(invokeMethodCode, type, cachedMethod.getName(), descriptor, useInterface); // produce result - BytecodeHelper.box(mv, cachedMethod.getReturnType()); - if (cachedMethod.getReturnType() == void.class) { + Class<?> returnType = cachedMethod.getReturnType(); + if (returnType == void.class) { mv.visitInsn(Opcodes.ACONST_NULL); + } else if (returnType.isPrimitive()) { + Class<?> wrapperType = TypeUtil.autoboxType(returnType); + mv.visitMethodInsn(Opcodes.INVOKESTATIC, BytecodeHelper.getClassInternalName(wrapperType), "valueOf", "(" + BytecodeHelper.getTypeDescription(returnType) + ")" + BytecodeHelper.getTypeDescription(wrapperType), false); } // return diff --git a/src/main/java/org/codehaus/groovy/tools/DgmConverter.java b/src/main/java/org/codehaus/groovy/tools/DgmConverter.java index c9cc4b5b01..57677874b3 100644 --- a/src/main/java/org/codehaus/groovy/tools/DgmConverter.java +++ b/src/main/java/org/codehaus/groovy/tools/DgmConverter.java @@ -19,6 +19,7 @@ package org.codehaus.groovy.tools; import org.codehaus.groovy.classgen.asm.BytecodeHelper; +import org.codehaus.groovy.classgen.asm.util.TypeUtil; import org.codehaus.groovy.control.CompilerConfiguration; import org.codehaus.groovy.reflection.CachedClass; import org.codehaus.groovy.reflection.CachedMethod; @@ -204,9 +205,11 @@ public class DgmConverter { loadParameters(method, 2, mv); } mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(method.getDeclaringClass().getTheClass()), method.getName(), methodDescriptor, false); - BytecodeHelper.box(mv, returnType); - if (method.getReturnType() == void.class) { + if (returnType == void.class) { mv.visitInsn(ACONST_NULL); + } else if (returnType.isPrimitive()) { + Class<?> wrapperType = TypeUtil.autoboxType(returnType); + mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(wrapperType), "valueOf", "(" + BytecodeHelper.getTypeDescription(returnType) + ")" + BytecodeHelper.getTypeDescription(wrapperType), false); } mv.visitInsn(ARETURN); mv.visitMaxs(0, 0); @@ -221,9 +224,11 @@ public class DgmConverter { BytecodeHelper.doCast(mv, method.getParameterTypes()[0].getTheClass()); loadParameters(method, 2, mv); mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(method.getDeclaringClass().getTheClass()), method.getName(), methodDescriptor, false); - BytecodeHelper.box(mv, returnType); - if (method.getReturnType() == void.class) { + if (returnType == void.class) { mv.visitInsn(ACONST_NULL); + } else if (returnType.isPrimitive()) { + Class<?> wrapperType = TypeUtil.autoboxType(returnType); + mv.visitMethodInsn(INVOKESTATIC, BytecodeHelper.getClassInternalName(wrapperType), "valueOf", "(" + BytecodeHelper.getTypeDescription(returnType) + ")" + BytecodeHelper.getTypeDescription(wrapperType), false); } mv.visitInsn(ARETURN); mv.visitMaxs(0, 0);
