diff --git a/src/com/wentch/redkale/net/sncp/Sncp.java b/src/com/wentch/redkale/net/sncp/Sncp.java index 2450ef5c0..180a53034 100644 --- a/src/com/wentch/redkale/net/sncp/Sncp.java +++ b/src/com/wentch/redkale/net/sncp/Sncp.java @@ -382,7 +382,15 @@ public abstract class Sncp { } { // _方法 mv = new DebugMethodVisitor(cw.visitMethod(ACC_PUBLIC + (method.isVarArgs() ? ACC_VARARGS : 0), "_" + method.getName(), "(ZZZ" + methodDesc.substring(1), null, null)); - //mv.setDebug(true); + //mv.setDebug(true); + { //给参数加上 Annotation + final Annotation[][] anns = method.getParameterAnnotations(); + for (int k = 0; k < anns.length; k++) { + for (Annotation ann : anns[k]) { + visitAnnotation(mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true), ann); + } + } + } av0 = mv.visitAnnotation(sncpDynDesc, true); av0.visit("index", index); av0.visitEnd(); diff --git a/src/com/wentch/redkale/net/sncp/SncpClient.java b/src/com/wentch/redkale/net/sncp/SncpClient.java index 0fd232e6e..b26453a98 100644 --- a/src/com/wentch/redkale/net/sncp/SncpClient.java +++ b/src/com/wentch/redkale/net/sncp/SncpClient.java @@ -202,7 +202,7 @@ public final class SncpClient { try { final SncpAction action = actions[index]; in.setBytes(future.get(5, TimeUnit.SECONDS)); - byte i = 0; + byte i; while ((i = in.readByte()) != 0) { final Attribute attr = action.paramAttrs[i]; attr.set(params[i - 1], convert.convertFrom(in, attr.type())); diff --git a/src/com/wentch/redkale/source/EntityCallAttribute.java b/src/com/wentch/redkale/source/EntityCallAttribute.java index 4b3cee1f4..b456e8243 100644 --- a/src/com/wentch/redkale/source/EntityCallAttribute.java +++ b/src/com/wentch/redkale/source/EntityCallAttribute.java @@ -16,7 +16,7 @@ import java.util.concurrent.*; * @param * @param */ -public final class EntityCallAttribute implements Attribute { +public final class EntityCallAttribute implements Attribute { public static final EntityCallAttribute instance = new EntityCallAttribute(); @@ -46,37 +46,37 @@ public final class EntityCallAttribute implements Attribute { } @Override - public Class type() { - return (Class) (Class) Serializable[].class; + public Class type() { + return (Class) Object.class; } @Override public Class declaringClass() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return (Class) (Class) Object[].class; } @Override public String field() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return ""; } @Override - public F[] get(final T[] objs) { + public F get(final T[] objs) { if (objs == null || objs.length == 0) return null; - final Attribute attr = (Attribute) load(objs[0].getClass()); - final F[] keys = (F[]) Array.newInstance(attr.type(), objs.length); + final Attribute attr = (Attribute) load(objs[0].getClass()); + final Object keys = Array.newInstance(attr.type(), objs.length); for (int i = 0; i < objs.length; i++) { - keys[i] = attr.get(objs[i]); + Array.set(keys, i, attr.get(objs[i])); } - return keys; + return (F) keys; } @Override - public void set(final T[] objs, final F[] keys) { + public void set(final T[] objs, final F keys) { if (objs == null || objs.length == 0) return; final Attribute attr = (Attribute) load(objs[0].getClass()); for (int i = 0; i < objs.length; i++) { - attr.set(objs[i], (F) keys[i]); + attr.set(objs[i], (F) Array.get(keys, i)); } }