Bug 50443

Summary: LVTT entry for 'ht' does not match any LVT entry
Product: BCEL - Now in Jira Reporter: Gang <gxs213>
Component: MainAssignee: issues <issues>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Gang 2010-12-09 11:57:20 UTC
I used the BCEL v5.2 to do experiments on my test cases, and met the following problem.

D:\java test._Test10
Exception in thread "main" java.lang.ClassFormatError: LVTT entry for 'ht' in cl
ass file test/_Test10 does not match any LVT entry
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: test._Test10.  Program will exit.

My test case is as follows:
public class _Test10 {
	public static void main (String [] args){
		 HashMap <Double,Integer> ht = new HashMap<Double,Integer>();

Using BCEL, I didn't make any change of the original Method. Using it, I generated a new Method and replaced it with the new one.

ClassGen _cg = new ClassGen(_claz);
for (Method oldMethod : _inMethods) {
	MethodGen mg = new MethodGen(oldMethod, _inClass.getClassName(), _cpg);
	Method newMethod = mg.getMethod();
	_cg.replaceMethod(oldMethod, newMethod);