Bug 50443 - LVTT entry for 'ht' does not match any LVT entry
Summary: LVTT entry for 'ht' does not match any LVT entry
Status: NEW
Alias: None
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.2
Hardware: PC Windows XP
: P2 major
Target Milestone: ---
Assignee: issues@commons.apache.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 11:57 UTC by Gang
Modified: 2010-12-09 11:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
1)
        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);
}