This commit is contained in:
redkale
2024-10-13 14:20:13 +08:00
parent 399df22672
commit f65c02677f
2 changed files with 14 additions and 6 deletions

View File

@@ -134,6 +134,8 @@ public class HttpContext extends Context {
{ // 构造方法 { // 构造方法
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PUBLIC, "<init>", "(" + handlerDesc + ")V", null, null)); mv = new MethodDebugVisitor(cw.visitMethod(ACC_PUBLIC, "<init>", "(" + handlerDesc + ")V", null, null));
// mv.setDebug(true); // mv.setDebug(true);
Label label0 = new Label();
mv.visitLabel(label0);
{ {
av0 = mv.visitAnnotation(cpDesc, true); av0 = mv.visitAnnotation(cpDesc, true);
{ {
@@ -150,6 +152,10 @@ public class HttpContext extends Context {
mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 1);
mv.visitFieldInsn(PUTFIELD, newDynName, "handler", handlerDesc); mv.visitFieldInsn(PUTFIELD, newDynName, "handler", handlerDesc);
mv.visitInsn(RETURN); mv.visitInsn(RETURN);
Label label2 = new Label();
mv.visitLabel(label2);
mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0);
mv.visitLocalVariable("handler", handlerDesc, null, label0, label2, 1);
mv.visitMaxs(2, 2); mv.visitMaxs(2, 2);
mv.visitEnd(); mv.visitEnd();
} }

View File

@@ -23,6 +23,7 @@ import org.redkale.asm.Asms;
import org.redkale.asm.ClassWriter; import org.redkale.asm.ClassWriter;
import static org.redkale.asm.ClassWriter.COMPUTE_FRAMES; import static org.redkale.asm.ClassWriter.COMPUTE_FRAMES;
import org.redkale.asm.FieldVisitor; import org.redkale.asm.FieldVisitor;
import org.redkale.asm.Label;
import org.redkale.asm.MethodDebugVisitor; import org.redkale.asm.MethodDebugVisitor;
import static org.redkale.asm.Opcodes.*; import static org.redkale.asm.Opcodes.*;
import org.redkale.convert.ConvertColumn; import org.redkale.convert.ConvertColumn;
@@ -101,12 +102,7 @@ public final class SncpRemoteAction {
this.paramTypes = TypeToken.getGenericType(method.getGenericParameterTypes(), serviceImplClass); this.paramTypes = TypeToken.getGenericType(method.getGenericParameterTypes(), serviceImplClass);
this.paramClasses = method.getParameterTypes(); this.paramClasses = method.getParameterTypes();
Type pt = createParamComposeBeanType( Type pt = createParamComposeBeanType(
RedkaleClassLoader.currentClassLoader(), RedkaleClassLoader.currentClassLoader(), serviceImplClass, method, actionid, paramTypes, paramClasses);
serviceImplClass,
method,
actionid,
paramTypes,
paramClasses);
this.paramComposeBeanType = pt; this.paramComposeBeanType = pt;
this.paramComposeBeanCreator = this.paramComposeBeanCreator =
(pt == null || pt == paramTypes[0]) ? null : Creator.load(TypeToken.typeToClass(pt), 1); (pt == null || pt == paramTypes[0]) ? null : Creator.load(TypeToken.typeToClass(pt), 1);
@@ -307,6 +303,8 @@ public final class SncpRemoteAction {
} }
{ // 一个参数的构造函数 { // 一个参数的构造函数
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PUBLIC, "<init>", "([Ljava/lang/Object;)V", null, null)); mv = new MethodDebugVisitor(cw.visitMethod(ACC_PUBLIC, "<init>", "([Ljava/lang/Object;)V", null, null));
Label label0 = new Label();
mv.visitLabel(label0);
mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
for (int i = 1; i <= paramClasses.length; i++) { for (int i = 1; i <= paramClasses.length; i++) {
@@ -319,6 +317,10 @@ public final class SncpRemoteAction {
mv.visitFieldInsn(PUTFIELD, newDynName, "arg" + i, paramDesc); mv.visitFieldInsn(PUTFIELD, newDynName, "arg" + i, paramDesc);
} }
mv.visitInsn(RETURN); mv.visitInsn(RETURN);
Label label2 = new Label();
mv.visitLabel(label2);
mv.visitLocalVariable("this", "L" + newDynName + ";", null, label0, label2, 0);
mv.visitLocalVariable("params", "[Ljava/lang/Object;", null, label0, label2, 1);
mv.visitMaxs(3, 2); mv.visitMaxs(3, 2);
mv.visitEnd(); mv.visitEnd();
} }