Prev: final methods and classes
Next: struts2 + netbeans
From: MarlonBrando on 15 Oct 2009 09:42 the asm-guider.pdf said: [This means that annotations and attributes, if any, must be visited first, followed by the methods bytecode] but when i use it, for example MethodVisitor mv = new CheckMethodAdapter(cw.visitMethod( ACC_PUBLIC, "get" + Helper.capitalize(property), "()Ljava/lang/String;", null, null)); mv.visitAttribute(new MethodAttribute(cw)); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, Type.getType(clazz) .getInternalName(), property, Type .getDescriptor(AtomicLong.class)); // mv.visitInsn(LCONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, Type.getType (AtomicLong.class) .getInternalName(), "get", "()J"); mv.visitMethodInsn(INVOKESTATIC, Type.getType(Long.class) .getInternalName(), "valueOf", "(J)Ljava/lang/ Long;"); mv.visitMethodInsn(INVOKESTATIC, Type.getType (MonitorUtil.class) .getInternalName(), "getFormatedMonitor", "(Ljava/lang/Long;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 1); mv.visitEnd(); i found the code order and the attribute order are reverse, using the bytecode tool [jclasslib] just looked like this: ...............Methods + [o] <init> - [1] getState - [0] org.aspectj.weaver.MethodDeclarationLineNumber - [1] code however, it should be : - [1] getState - [0] code - [1] org.aspectj.weaver.MethodDeclarationLineNumber plz help me..
From: Marcin Rzeźnicki on 15 Oct 2009 10:07 On 15 Paź, 15:42, MarlonBrando <beneo99...(a)gmail.com> wrote: > the asm-guider.pdf said: [This means that annotations and attributes, > if any, must be visited first, followed > by the methodâs bytecode] > > > plz help me.. I am not sure whether I understand fully your problem, but the way I see it the order of attributes is not important.
From: Marcin Rzeźnicki on 15 Oct 2009 10:10 On 15 Paź, 15:42, MarlonBrando <beneo99...(a)gmail.com> wrote: > the asm-guider.pdf said: [This means that annotations and attributes, > if any, must be visited first, followed > by the methodâs bytecode] > > plz help me.. Google ate my reply. :-) I am not sure if I understand fully your problem, but the way I see it the order of attributes is not important.
From: Jeff Higgins on 15 Oct 2009 10:27 > Google ate my reply. :-) And burped it back up. Yuck. :-)
From: Marcin Rzeźnicki on 15 Oct 2009 10:29
On 15 Paź, 16:27, Jeff Higgins <oohigg...(a)yahoo.com> wrote: > > Google ate my reply. :-) > > And burped it back up. Yuck. :-) Nasty stinky Google dog :-) |