Bug 10616

Summary: StringIndexOutOfBoundsException opening type selection dialog
Product: [Eclipse Project] JDT Reporter: Knut Radloff <knut_radloff>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: martinae
Version: 2.0   
Target Milestone: 2.0 M4   
Hardware: PC   
OS: Windows NT   
Whiteboard:
Attachments:
Description Flags
Stack trace none

Description Knut Radloff CLA 2002-03-01 15:48:59 EST
build 20020228

I got the attached walkback when I selected Workbench->Open Type.
I can provide the workspace if needed.
Comment 1 Knut Radloff CLA 2002-03-01 15:49:43 EST
Created attachment 415 [details]
Stack trace
Comment 2 Claude Knaus CLA 2002-03-04 04:43:30 EST
Knut,
I'd be interested in the workspace. Can you send it to me? There was a problem 
before with Java Mail 1.2 API classes where Anonymous classes were 'visible' in 
the Java model. We're probably seeing a similar problem here.
Comment 3 Knut Radloff CLA 2002-03-04 11:12:56 EST
I've uploaded the workspace as walleye:/va2000/INCOMING/forKnut/10616.zip
Comment 4 Claude Knaus CLA 2002-03-08 06:32:05 EST
I tried to launch your workspace using 20020228 w/o success. It gets stuck at 
some point... Is it possible that you use plugins I don't have?
Comment 5 Knut Radloff CLA 2002-03-08 09:34:42 EST
I'm using the new Team 2.0 plugins, other than that it's all standard.
Does the log say anything?
The same problem occured using build 0305 on another machine/workspace.
Both workspaces have the same projects loaded:
org.eclipse.swt (dev.eclipse.org)
org.eclipse.swt.examples (dev.eclipse.org)
org.eclipse.swt.internal (ottcvs1.ott.oti.com, /home/cvs/swtwork)
Playground_Knut (ottcvs1.ott.oti.com, /home/cvs/swtwork)

You could try reproducing by loading the above projects although I'm not sure 
if you would experience the problem right away. Also, you may not have access 
to the swtwork repo.
Comment 6 Knut Radloff CLA 2002-03-08 10:13:26 EST
On second thought, the workspace may reference the J9 launcher plugin, availabe 
on the jdt debug homepage.
Comment 7 Claude Knaus CLA 2002-03-11 11:14:13 EST
ok, I managed to launch the workspace. It's just that it takes an awful long 
time to launch it. The bug is reproducible, at least with 20020228.
Comment 8 Knut Radloff CLA 2002-03-11 12:55:21 EST
Problem still occurs with build 20020307.
Comment 9 Claude Knaus CLA 2002-03-12 04:36:03 EST
This bug is related to 6839. A compilation error ('bew' instead of 'new') 
yields the java model to return a type ref (of the anonymous class) with empty 
name.

To reproduce, do the following:

  1) Copy the compilation unit below into a package called 'bugs'.
  2) Do a 'OpenType' and wait for the StringIndexOutOfBoundException.

---8<---
package bugs;

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

/**
 */
public class Bug_7345 {
	static boolean bold = false;
	
public static void main(String arguments[]) {
	Shell shell = new Shell(SWT.MENU | SWT.RESIZE | SWT.TITLE | 
SWT.H_SCROLL);
	StyledText text = new StyledText(shell, SWT.WRAP); 

	shell.addListener(SWT.Resize, new Listener() {
		public void handleEvent(Event e) {
			text.setBounds(shell.getClientArea());			
		}
	});	
	shell.addListener(SWT.KeyDown, bew Listener () {
		public void handleEvent(Event e) {
			bold = !bold;
		}
	});
	text.addLineStyleListener(new LineStyleListener() {
		public void lineGetStyle(LineStyleEvent event) {
			event.styles = new StyleRange[] {new StyleRange(0, 20, 
null, null)};
			if (bold) {
				event.styles[0].fontStyle = SWT.BOLD;
			}
			text.redrawRange(0, 20, false);
		}
	});
	text.setText("This is the first line");
	shell.open();

	Display display = shell.getDisplay ();
	while (!shell.isDisposed ())
		if (!display.readAndDispatch ()) display.sleep ();
}
}
Comment 10 Claude Knaus CLA 2002-03-12 04:43:50 EST
Knut,

If you get rid of that file in your workspace (or fix the syntax error), you'll 
be able to use open type again.
Comment 11 Philipe Mulet CLA 2002-03-12 08:04:34 EST
This was a bug in the syntax recovery, which failed to rebuild properly the 
unit picture for subsequent anonymous local types.

Fixed
Comment 12 Philipe Mulet CLA 2002-03-12 12:03:06 EST
*** Bug 11191 has been marked as a duplicate of this bug. ***