Community
Participate
Working Groups
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"
Could not reproduce. Please provide the log file at <workspace>/.metadata/.log. It should contain entries related to what caused the action to fail.
 The content of the log file is as follows: !ENTRY org.eclipse.ui 4 4 六月 28, 2004 14:43:28.736 !MESSAGE The command for the key you pressed failed !ENTRY org.eclipse.ui 4 0 六月 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)
The ast should be created using the project's settings. Is this supported in Java Editor? Move to JDT/UI for comment.
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
*** Bug 68829 has been marked as a duplicate of this bug. ***
The following cu reproduces the problem in 3.1 M4: public class X{ public void foo() { assert (true): ("hello"); } }
Fixed and released in HEAD. Regression test added in ASTConverter15Test.test0101.
Verified in I20050215-2300