Bug 8776 - 1.0 Snippet editor does not work with new J9 JCLs
Summary: 1.0 Snippet editor does not work with new J9 JCLs
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-30 13:07 EST by Darin Wright CLA
Modified: 2002-02-13 06:26 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 2002-01-30 13:07:26 EST
The 1.0 Snippet editor does not work with the latest J9 JCLs. The reason for 
this is that the implementation of "Method.invoke(...)" has changed from being 
native, to being source. As the snippet editor attempts to position itself to 
the correct location to perform an evaluation, an assumption it makes about the 
number of frames on the stack is now invalid.
Comment 1 Darin Wright CLA 2002-01-30 13:51:09 EST
Source for patch in JavaSnippetEditor#handleDebugEvent

	public void handleDebugEvent(DebugEvent e) {
		Object source = e.getSource();
		if (source instanceof IDebugElement) {
			IDebugElement de = (IDebugElement)source;
			if (de.getElementType() == IDebugElement.DEBUG_TARGET) {
				if (de.getDebugTarget().equals(fVM)) {
					if (e.getKind() == 
DebugEvent.TERMINATE) {
						Runnable r = new Runnable() {
							public void run() {
								vmTerminated();
							}
						};
						getShell().getDisplay
().asyncExec(r);
					}
				}
			} else if (de instanceof IJavaThread) {
				if (e.getKind() == DebugEvent.SUSPEND) {
					IJavaThread jt = (IJavaThread)de;
					try {
						IJavaStackFrame f= 
(IJavaStackFrame)jt.getTopStackFrame();
						if (f != null) {
							if (e.getDetail() == 
DebugEvent.STEP_END && f.getLineNumber() == 9 && f.getDeclaringTypeName().equals
("org.eclipse.jdt.internal.ui.snippeteditor.ScrapbookMain1")) { //$NON-NLS-1$
								fThread = jt;
							} else if (e.getDetail
() == DebugEvent.BREAKPOINT && jt.getBreakpoint().equals
(ScrapbookLauncher.getDefault().getMagicBreakpoint(jt.getDebugTarget()))) {
								// locate 
the 'eval' method and step over
								IDebugElement[] 
frames = jt.getChildren();
								for (int i = 0; 
i < frames.length; i++) {
								
	IJavaStackFrame frame = (IJavaStackFrame)frames[i];
									if 
(frame.getReceivingTypeName().equals
("org.eclipse.jdt.internal.ui.snippeteditor.ScrapbookMain1") && frame.getName
().equals("eval")) { //$NON-NLS-1$ //$NON-NLS-2$
									
	frame.stepOver();
									
	break;
									}
								}
							}
						}
					} catch (DebugException ex) {
						JavaPlugin.log(ex);
					}
				}
			}
		}
	}
Comment 2 Kai-Uwe Maetzel CLA 2002-02-08 09:29:51 EST
Included changed with rollup2, version 1.0.
Comment 3 Andre Weinand CLA 2002-02-13 06:26:03 EST
Verified for J9: ive11022001.zip