Bug 68823 - [dom] Ctrl+C command fails when "assert" is enabled
Summary: [dom] Ctrl+C command fails when "assert" is enabled
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 68829 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-28 17:12 EDT by worookie CLA
Modified: 2005-02-16 10:06 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 worookie CLA 2004-06-28 17:12:31 EDT
Steps to reproduce the bug:

* create a new java file and add a line with an assert statement such as:
assert (true): ("hello");

* eclipse v3.0 won't be able to compile the file unless the jdk compliance is
adjusted to jdk1.4, namely, by changing the settings:
Project -> Properties -> Java Compiler -> Use project settings -> Compliance and
Classfiles -> change all settings values to 1.4

* once the compliance is changed to 1.4, then Ctrl+C doesn't work properly. for
example, first type Ctrl+A to select all contents of the java file, and type
Ctrl+C, then you will get a warning popup window which says:
"Error Executing Command
The command for the key you pressed failed
Reason:
The command for the key you pressed failed"
Comment 1 Rafael Chaves CLA 2004-06-28 17:18:24 EDT
Could not reproduce. Please provide the log file at <workspace>/.metadata/.log.
It should contain entries related to what caused the action to fail.
Comment 2 worookie CLA 2004-06-28 17:50:22 EDT
&#65279;
The content of the log file is as follows:

!ENTRY org.eclipse.ui 4 4 &#20845;&#26376; 28, 2004 14:43:28.736
!MESSAGE The command for the key you pressed failed

!ENTRY org.eclipse.ui 4 0 &#20845;&#26376; 28, 2004 14:43:28.746
!MESSAGE The command for the key you pressed failed
!STACK 0
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2587)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1894)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1810)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:770)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:336)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:274)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:152)
	at org.eclipse.jdt.core.dom.ASTParser.convert(ASTParser.java:711)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:681)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:439)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:391)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.getClipboardData(ClipboardOperationAction.java:363)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doCutCopyWithImportsOperation(ClipboardOperationAction.java:300)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.internalDoOperation(ClipboardOperationAction.java:256)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction$1.run(ClipboardOperationAction.java:225)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.run(ClipboardOperationAction.java:223)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:132)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:889)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:930)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:548)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:496)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:261)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:740)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1734)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1730)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3067)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:2970)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3338)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1467)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2429)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
	at org.eclipse.core.launcher.Main.run(Main.java:644)
	at org.eclipse.core.launcher.Main.main(Main.java:628)
Comment 3 Olivier Thomann CLA 2004-06-29 17:43:58 EDT
The ast should be created using the project's settings.
Is this supported in Java Editor?

Move to JDT/UI for comment.
Comment 4 Dirk Baeumer CLA 2004-06-30 05:06:49 EDT
The AST is created via the ASTParser. Source is set via setSource methods. 
Regarding to the Javadoc this should automatically use the compiler options 
appropriate for the compilation unit or class file.

Moving back to JDT/Core
Comment 5 Dirk Baeumer CLA 2004-07-01 05:07:28 EDT
*** Bug 68829 has been marked as a duplicate of this bug. ***
Comment 6 Jerome Lanneluc CLA 2004-12-17 12:27:49 EST
The following cu reproduces the problem in 3.1 M4:
public class X{
	public void foo() {
		assert (true): ("hello");
	}
}
Comment 7 Olivier Thomann CLA 2005-01-05 16:40:12 EST
Fixed and released in HEAD.
Regression test added in ASTConverter15Test.test0101.
Comment 8 David Audel CLA 2005-02-16 10:06:34 EST
Verified in I20050215-2300