You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (JIRA)" <ji...@apache.org> on 2014/04/24 10:39:15 UTC

[jira] [Updated] (BCEL-88) bcelified method doesn't pass verification

     [ https://issues.apache.org/jira/browse/BCEL-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg updated BCEL-88:
-------------------------------

         Priority: Blocker
    Fix Version/s: 6.0
         Priority:   (was: P2)
         Severity:   (was: normal)

> bcelified method doesn't pass verification
> ------------------------------------------
>
>                 Key: BCEL-88
>                 URL: https://issues.apache.org/jira/browse/BCEL-88
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>    Affects Versions: 5.1
>         Environment: Operating System: Linux
> Platform: Other
>            Reporter: Raffaele Spazzoli
>            Assignee: Apache Commons Developers
>            Priority: Blocker
>             Fix For: 6.0
>
>         Attachments: BCELifierSampleBean.java
>
>
> I bclified the following method:
>   public String toString() {
>     return ReflectionToStringBuilder.toString(this);
>   }
> Which is the standard toString for bean as suggested by the commons-lang project.
> This code is generated:
>   private void createMethod_7() {
>     InstructionList il = new InstructionList();
>     MethodGen method = new MethodGen(ACC_PUBLIC, Type.STRING, Type.NO_ARGS, new
> String[] {  }, "toString",
> "it.imolinfo.iif.webservices.utils.generators.BCELifierSampleBean", il, _cp);
>     InstructionHandle ih_0 = il.append(_factory.createLoad(Type.OBJECT, 0));
>    
> il.append(_factory.createInvoke("org.apache.commons.lang.builder.ReflectionToStringBuilder",
> "toString", Type.STRING, new Type[] { Type.OBJECT }, Constants.INVOKESTATIC));
>     InstructionHandle ih_4 = il.append(_factory.createReturn(Type.OBJECT));
>     method.setMaxStack();
>     method.setMaxLocals();
>     _cg.addMethod(method.getMethod());
>     il.dispose();
>   }
> I'm reporting only the method that goes in error, in attachement there is the
> whole class.
> When I try to run the code and verify the class generated I get the following error:
> verify failed on step 3b on class:
> it.imolinfo.iif.webservices.utils.generators.BCELifierSampleBeanon method:
> toString message: Constraint violated in method 'public String toString()':
> Instruction INVOKESTATIC constraint violated: Class
> 'org.apache.commons.lang.builder.ReflectionToStringBuilder' is referenced, but
> cannot be loaded and resolved: 'VERIFIED_REJECTED
> Number of LocalVariableTable attributes of Code attribute '<CODE>' (method
> 'static void <clinit>()') exceeds number of local variable slots '0' ('There may
> be no more than one LocalVariableTable attribute per local variable in the Code
> attribute.').
> '.
> InstructionHandle:    1: invokestatic[184](3) 48
> Execution Frame:
> Local Variables:
> 0: it.imolinfo.iif.webservices.utils.generators.BCELifierSampleBean
> OperandStack:
> Slots used: 1 MaxStack: 1.
> it.imolinfo.iif.webservices.utils.generators.BCELifierSampleBean (Size: 1)
> Execution flow:
>    0: aload_0	[InstructionContext]
>    1: invokestatic 48	[InstructionContext]
> 	at it.imolinfo.iif.jbi.BCELClassLoader.verifyClass(BCELClassLoader.java:66)
> 	at it.imolinfo.iif.jbi.BCELClassLoader.addClass(BCELClassLoader.java:27)
> 	at
> it.imolinfo.iif.test.webservices.utils.generators.BCELifierSampleBeanCreator.main(BCELifierSampleBeanCreator.java:260)
> Any idea if this is a bug or how to workaround it?
> Curiosly the twin method:
>   public boolean equals(Object obj) {
>     return EqualsBuilder.reflectionEquals(this, obj);
>   }
> is generated passes the verification.



--
This message was sent by Atlassian JIRA
(v6.2#6252)