Bug 4943 - Verification error
Summary: Verification error
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 4919 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-12 14:39 EDT by Darin Wright CLA
Modified: 2002-01-11 09:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2001-10-12 14:39:25 EDT
Using build 204, I get a verification error when trying to instantiate
JDK12DebugLauncher. (No problem when I fall back to 203). The runtime error is:

4 org.eclipse.ui 0 (class: 
org/eclipse/jdt/internal/ui/launcher/JDK12DebugLauncher, method: run signature: 
(Lorg/eclipse/jdt/launching/VMRunnerConfiguration;)
Lorg/eclipse/jdt/launching/VMRunnerResult;) Localvariable 16 contains wrong type
java.lang.VerifyError: (class: 
org/eclipse/jdt/internal/ui/launcher/JDK12DebugLauncher, method: run signature: 
(Lorg/eclipse/jdt/launching/VMRunnerConfiguration;)
Lorg/eclipse/jdt/launching/VMRunnerResult;) Localvariable 16 contains wrong type
	at org.eclipse.jdt.internal.ui.launcher.StandardVM.getVMRunner
(StandardVM.java:37)
	at 
org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.getVMRunner
(JavaApplicationLauncherDelegate.java:213)
	at 
org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.doLaunch
(JavaApplicationLauncherDelegate.java:135)
	at 
org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.launchEleme
nt(JavaApplicationLauncherDelegate.java:82)
	at 
org.eclipse.jdt.internal.ui.launcher.JavaApplicationLauncherDelegate.launch
(JavaApplicationLauncherDelegate.java:94)
	at org.eclipse.debug.internal.core.Launcher.launch(Launcher.java:104)
	at org.eclipse.debug.internal.ui.RelaunchActionDelegate.relaunch
(RelaunchActionDelegate.java:37)
	at org.eclipse.debug.internal.ui.RelaunchActionDelegate.relaunch
(RelaunchActionDelegate.java:46)
	at org.eclipse.debug.internal.ui.RelaunchHistoryLaunchAction$1.run
(RelaunchHistoryLaunchAction.java:49)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at org.eclipse.debug.internal.ui.RelaunchHistoryLaunchAction.run
(RelaunchHistoryLaunchAction.java:47)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:451)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java
(Compiled Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:645)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1359)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1160)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:675)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:658)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)

The code looks like:


	/**
	 * @see IVMRunner#run
	 */
	public VMRunnerResult run(VMRunnerConfiguration config) throws 
CoreException {
		int port= SocketUtil.findUnusedLocalPort(null, 5000, 15000);
		if (port == -1) {
			throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.noPort"), null)); //$NON-NLS-1$
		}
		String location= getJDKLocation(""); //$NON-NLS-1$
		if ("".equals(location)) { //$NON-NLS-1$
			throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.error.noJDKHome"), null)); //$NON-NLS-1
$
		}
		String program= 
location+File.separator+"bin"+File.separator+"java"; //$NON-NLS-2$ //$NON-NLS-1$
		File javawexe= new File(program+"w.exe"); //$NON-NLS-1$
		File javaw= new File(program+"w"); //$NON-NLS-1$
		
		if (javaw.isFile()) 
			program= javaw.getAbsolutePath();
		else if (javawexe.isFile())
			program= javawexe.getAbsolutePath();

		Vector arguments= new Vector();

		arguments.addElement(program);

		String[] bootCP= config.getBootClassPath();
		if (bootCP.length > 0) {
			arguments.add("-Xbootclasspath:"+convertClassPath
(bootCP)); //$NON-NLS-1$
		} 
		
		String[] cp= config.getClassPath();
		if (cp.length > 0) {
			arguments.add("-classpath"); //$NON-NLS-1$
			arguments.add(convertClassPath(cp));
		}
		addArguments(config.getVMArguments(), arguments);

		arguments.add("-Xdebug"); //$NON-NLS-1$
		arguments.add("-Xnoagent"); //$NON-NLS-1$
		arguments.add("-Djava.compiler=NONE"); //$NON-NLS-1$
		arguments.add("-
Xrunjdwp:transport=dt_socket,address=127.0.0.1:" + port); //$NON-NLS-1$

		arguments.add(config.getClassToLaunch());
		addArguments(config.getProgramArguments(), arguments);
		String[] cmdLine= new String[arguments.size()];
		arguments.copyInto(cmdLine);

		ListeningConnector connector= getConnector();
		if (connector == null) {
			throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.error.noConnector"), null)); //$NON-
NLS-1$
		}
		Map map= connector.defaultArguments();
		int timeout= fVMInstance.getDebuggerTimeout();
		
		specifyArguments(map, port, timeout);
		Process p= null;
		try {
			try {
				connector.startListening(map);

				try {
					p= Runtime.getRuntime().exec(cmdLine);
		
				} catch (IOException e) {
					if (p != null) {
						p.destroy();
					}
					throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.error.title"), e)); //$NON-NLS-1$
				}
		
				IProcess process= DebugPlugin.getDefault
().newProcess(p, renderProcessLabel(cmdLine));
				process.setAttribute(JavaRuntime.ATTR_CMDLINE, 
renderCommandLine(cmdLine));
				//try {
				//	Thread.currentThread().sleep(5000);
				//} catch (InterruptedException e) {
				//}
				boolean retry= false;
				do  {
					try {
						VirtualMachine vm= 
connector.accept(map);
						setTimeout(vm);
						IDebugTarget debugTarget= 
JDIDebugModel.newDebugTarget(vm, renderDebugTarget(config.getClassToLaunch(), 
port), process, true, false);
						return new VMRunnerResult
(debugTarget, new IProcess[] { process });
					} catch (InterruptedIOException e) {
						retry= fRetryQuery.queryRetry();
					}
				} while (retry);
			} finally {
				connector.stopListening(map);
			}
		} catch (IOException e) {
			throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.error.connect"), e)); //$NON-NLS-1$
		} catch (IllegalConnectorArgumentsException e) {
			throw new CoreException(createStatus
(LauncherMessages.getString("jdkLauncher.error.connect"), e)); //$NON-NLS-1$
		}
		if (p != null)
			p.destroy();
		return null;
	}
Comment 1 Rodrigo Peretti CLA 2001-10-12 15:28:01 EDT
I've got a similar problem running Core Test Cases. When compiling with 204 I 
cannot run and get the following stack trace. When compiling with 202a I can 
run on both 202a and 204. I can provide further information if necessary.

2 org.eclipse.core.runtime 2 Problems occurred when invoking code from plug-
in: org.eclipse.core.runtime.
java.lang.VerifyError: (class: org/eclipse/core/internal/resources/Workspace, 
method: delete signature: 
([Lorg/eclipse/core/resources/IResource;ZLorg/eclipse/core/runtime/IProgressMon
itor;)Lorg/eclipse/core/runtime/IStatus;) Localvariable 5 contains wrong type
	at org.eclipse.core.resources.ResourcesPlugin.constructWorkspace
(ResourcesPlugin.java:91)
	at org.eclipse.core.resources.ResourcesPlugin.startup
(ResourcesPlugin.java:134)
	at org.eclipse.core.internal.plugins.PluginDescriptor$1.run
(PluginDescriptor.java:644)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:814)
	at 
Comment 2 Philipe Mulet CLA 2001-10-13 13:05:00 EDT
This bug was introduced when dealing with another verification error:
1GDS7IP:  ITPJCORE:WIN2000 - VerifyError related to a local index computation

Problem comes from the fact that it appears that bytecode verifiers want:

(1) secret try return addresses must be allocated after any local variables in 
the method 
(2) variables local to a finally block need to be allocated behind the ones from 
the matching try block. 

Fixed in HEAD. Issuing a patch for 204 (not the optimal, simply reverting to 
<204 behavior for bug introduced try statement). The new code needs more 
testing.
The old code (<203) did not do either one of these. 204 dealt properly with (2) 
but since it did not do anything special for return addresses, then many more 
code patterns broke (1) since return addresses reused the same location, like 
the test cases mentionned on this PR.

Comment 3 Philipe Mulet CLA 2001-10-13 13:07:42 EDT
*** Bug 4919 has been marked as a duplicate of this bug. ***