Bug 39695 - java.lang.ClassFormatError: LVTT entry for 'local' in class file org/shiftone/jrat/test/dummy/CrashTestDummy does not match any LVT entry
Summary: java.lang.ClassFormatError: LVTT entry for 'local' in class file org/shiftone...
Status: RESOLVED FIXED
Alias: None
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: Other other
: P2 critical
Target Milestone: ---
Assignee: issues@commons.apache.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-31 20:43 UTC by Jeff Drost
Modified: 2007-04-01 07:59 UTC (History)
2 users (show)



Attachments
copying the LVTT entries from method to MethodGen (2.79 KB, patch)
2007-03-28 11:41 UTC, Erik Bengtson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Drost 2006-05-31 20:43:51 UTC
I have tried both the release at http://people.apache.org/~tcurdt/bcel/rc2/ , as
well as a build from head (410655).  I see the same ClassFormatError with both.

I get this error when running a JRat test case.  This project and the test case
is avalible on sourceforge (http://sourceforge.net/projects/jrat) - or I can
provide it directly.  The test case uses BCEL to isntrument a class and then
tries to execute methods various methods on it.

see org.shiftone.jrat.test.InjectorTestCase


java.lang.ClassFormatError: LVTT entry for 'local' in class file
org/shiftone/jrat/test/dummy/CrashTestDummy does not match any LVT entry
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
	at org.shiftone.jrat.test.TestClassLoader.loadClass(TestClassLoader.java:36)
	at org.shiftone.jrat.test.InjectorTestCase.setUp(InjectorTestCase.java:52)
	at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Comment 1 Jeff Drost 2006-05-31 20:55:24 UTC
Compiling with -g:lines,source fixes the problem however this is not an
acceptable option for me since a user may want to profile code that they didn't
write or have the source for.
Comment 2 Torsten Curdt 2006-06-01 00:25:02 UTC
fair enough ...could you provide a patch? With some luck it could then still make it into 5.2
Comment 3 Johann Uhrmann 2006-11-02 00:10:28 UTC
Changed the severity to "critical" because it renders BCEL useless on Java5 or
newer.
Comment 4 Torsten Curdt 2007-03-10 07:36:00 UTC
What's the status here? Did you try with trunk? Would be great if you could
attach the testcase.
Comment 5 Erik Bengtson 2007-03-27 15:18:08 UTC
Just tried with HEAD and does not work

java.lang.ClassFormatError: LVTT entry for 'employees' in class file
Comment 6 Erik Bengtson 2007-03-27 15:22:07 UTC
The classes I'm using against trunk HEAD. Hope this helps

class Department implements java.io.Serializable
{
    private Collection<Employee> employees;

    public Collection<Employee> getEmployees()
    {
        return employees;
    }
    public void setEmployees(Collection<Employee> employees)
    {
        this.employees = employees;
    }

}

class Employee implements java.io.Serializable
{
    private String name;
}
Comment 7 Erik Bengtson 2007-03-28 11:41:30 UTC
Created attachment 19834 [details]
copying the LVTT entries from method to MethodGen

This patch fixes this issue to me.

The fix is with copying the LVTT entries from method to MethodGen.

In addition, a cosmetic change in the MethodGen.toString method to output the
signature attributes, same as Method.toString does.
Comment 8 Erik Bengtson 2007-03-28 11:59:58 UTC
I forgot to say that the patch attached (2007-03-28 11:41), fix the case where a
setter having a generic argument is bytecode modified using BCEL. I dont know if
there are other cases. The patch works for me, for several classes and several
scenarios.

    public void setEmployees(Collection<Employee> employees)
    {
        this.employees = employees;
    }
Comment 9 Torsten Curdt 2007-04-01 07:59:17 UTC
Thanks! Applied!