DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40357>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40357

           Summary: bcelified method doesn't pass verification
           Product: BCEL
           Version: 5.1
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: bcel-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to