Bug 55421 - Cannot save a .java file in a non-java project anymore
Summary: Cannot save a .java file in a non-java project anymore
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 blocker (vote)
Target Milestone: 3.0 M8   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-19 15:18 EST by Olivier Thomann CLA
Modified: 2004-03-24 10:57 EST (History)
1 user (show)

See Also:


Attachments
Screenshot of the error dialog (8.26 KB, image/png)
2004-03-19 16:27 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2004-03-19 15:18:36 EST
Using build 03181131, it is not possible to save a .java file in a non-java project.

STEPS TO REPRODUCE
1) Start a fresh workspace
2) Create a simple project P
3) Create a file called A.java in P
4) Try to edit and save that file.
5) You get an error message saying that P doesn't exist.

Here is the stack trace:
Thread [main] (Suspended (breakpoint at line 1042 in JavaCore))
	JavaCore.create(IProject) line: 1042
	JavaModelManager.getPerProjectInfoCheckExistence(IProject) line: 804
	JavaProject.getPerProjectInfo() line: 1645
	JavaProject.getResolvedClasspath(boolean, boolean) line: 1756
	JavaProject.getResolvedClasspath(boolean) line: 1736
	JavaProject.buildStructure(OpenableElementInfo, IProgressMonitor, Map,
IResource) line: 261
	JavaProject(Openable).generateInfos(Object, HashMap, IProgressMonitor) line: 169
	PackageFragmentRoot(Openable).openParent(Object, HashMap, IProgressMonitor)
line: 382
	PackageFragmentRoot(Openable).generateInfos(Object, HashMap, IProgressMonitor)
line: 159
	PackageFragment(Openable).openParent(Object, HashMap, IProgressMonitor) line: 382
	PackageFragment(Openable).generateInfos(Object, HashMap, IProgressMonitor)
line: 159
	CompilationUnit(Openable).openParent(Object, HashMap, IProgressMonitor) line: 382
	CompilationUnit.openParent(Object, HashMap, IProgressMonitor) line: 1014
	CompilationUnit(Openable).generateInfos(Object, HashMap, IProgressMonitor)
line: 159
	CompilationUnit(JavaElement).openWhenClosed(Object, IProgressMonitor) line: 543
	CompilationUnit.makeConsistent(boolean, IProgressMonitor) line: 943
	ReconcileWorkingCopyOperation.executeOperation() line: 56
	ReconcileWorkingCopyOperation(JavaModelOperation).run(IProgressMonitor) line: 700
	ReconcileWorkingCopyOperation(JavaModelOperation).runOperation(IProgressMonitor)
line: 739
	CompilationUnit.reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor)
line: 1050
	CompilationUnit.reconcile(boolean, WorkingCopyOwner, IProgressMonitor) line: 1062
	CompilationUnit.reconcile() line: 1027
	CompilationUnitDocumentProvider.commitWorkingCopy(IProgressMonitor, Object,
CompilationUnitDocumentProvider$CompilationUnitInfo, boolean) line: 870
	CompilationUnitDocumentProvider$2.execute(IProgressMonitor) line: 935
	CompilationUnitDocumentProvider$2(TextFileDocumentProvider$DocumentProviderOperation).run(IProgressMonitor)
line: 93
	WorkspaceModifyDelegatingOperation.execute(IProgressMonitor) line: 67
	WorkspaceModifyOperation$1.run(IProgressMonitor) line: 91
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line:
1559
	WorkspaceModifyDelegatingOperation(WorkspaceModifyOperation).run(IProgressMonitor)
line: 105
	WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress,
ISchedulingRule) line: 72
	WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress) line: 62
	CompilationUnitDocumentProvider(TextFileDocumentProvider).executeOperation(TextFileDocumentProvider$DocumentProviderOperation,
IProgressMonitor) line: 391
	CompilationUnitDocumentProvider(TextFileDocumentProvider).saveDocument(IProgressMonitor,
Object, IDocument, boolean) line: 611
	CompilationUnitEditor(AbstractTextEditor).performSave(boolean,
IProgressMonitor) line: 3135
	CompilationUnitEditor.performSave(boolean, IProgressMonitor) line: 1171
	CompilationUnitEditor.doSave(IProgressMonitor) line: 1221
	EditorManager$10.run(IProgressMonitor) line: 982
	EditorManager$8.run(IProgressMonitor) line: 837
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 302
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display)
line: 252
	ApplicationWindow$1.run() line: 573
	BusyIndicator.showWhile(Display, Runnable) line: 84
	WorkbenchWindow(ApplicationWindow).run(boolean, boolean, IRunnableWithProgress)
line: 570
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 1493
	EditorManager.runProgressMonitorOperation(String, IRunnableWithProgress,
IWorkbenchWindow) line: 843
	EditorManager.savePart(ISaveablePart, IWorkbenchPart, boolean) line: 987
	WorkbenchPage.savePart(ISaveablePart, IWorkbenchPart, boolean) line: 2448
	WorkbenchPage.saveEditor(IEditorPart, boolean) line: 2460
	SaveAction.run() line: 72
	SaveAction(Action).runWithEvent(Event) line: 881
	ActionHandler.execute(Object) line: 68
	Command.execute(Object) line: 160
	WorkbenchKeyboard.executeCommand(String, Event) line: 475
	WorkbenchKeyboard.press(List, Event, boolean) line: 891
	WorkbenchKeyboard.processKeyEvent(List, Event, boolean) line: 935
	WorkbenchKeyboard.filterKeySequenceBindings(Event) line: 568
	WorkbenchKeyboard.access$2(WorkbenchKeyboard, Event) line: 500
	WorkbenchKeyboard$1.handleEvent(Event) line: 256
	EventTable.sendEvent(Event) line: 82
	Display.filterEvent(Event) line: 705
	StyledText(Widget).sendEvent(Event) line: 809
	StyledText(Widget).sendEvent(int, Event, boolean) line: 834
	StyledText(Widget).sendEvent(int, Event) line: 819
	StyledText(Control).sendKeyEvent(int, int, int, int, Event) line: 1720
	StyledText(Control).sendKeyEvent(int, int, int, int) line: 1716
	StyledText(Control).WM_CHAR(int, int) line: 3041
	StyledText(Control).windowProc(int, int, int, int) line: 2944
	Display.windowProc(int, int, int, int) line: 2962
	OS.DispatchMessageW(MSG) line: not available [native method]
	OS.DispatchMessage(MSG) line: 1438
	Display.readAndDispatch() line: 2100
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1448
	Workbench.runUI() line: 1419
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 257
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 139
	IDEApplication.run(Object) line: 90
	PlatformActivator$1.run(Object) line: 260
	EclipseStarter.run(Object) line: 173
	EclipseStarter.run(String[], Runnable) line: 106
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available
[native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	Main.basicRun(String[]) line: 305
	Main.run(String[]) line: 729
	Main.main(String[]) line: 713


CompilationUnitDocumentProvider.commitWorkingCopy has no protection against a
potential JavaModelException. reconcile() on IWorkingCopy can throw such exception.
This is a pretty bad problem that needs to be fixed asap.
Comment 1 Olivier Thomann CLA 2004-03-19 16:16:36 EST
This works fine using 200403100800. So this is something that changed within a week.
Comment 2 Olivier Thomann CLA 2004-03-19 16:27:26 EST
The problem appeared in build 200403161300.
I will attach the error dialog.
Comment 3 Olivier Thomann CLA 2004-03-19 16:27:49 EST
Created attachment 8712 [details]
Screenshot of the error dialog
Comment 4 Dani Megert CLA 2004-03-22 05:01:39 EST
We need some support regarding this blocker. We did not change any code in that
area, so we assume it is a J Core change which causes this. Up to now we were
able to reconcile and call commitWorkingCopy for a working copy even if the
underlying resource was in a non-Java-Model (J Core added code to support this -
see bug 41583). This is now broken since both methdos throw a does_not_exist
exception. Is this change intentional? And if so, how should we
1) reconcile the working copy with the buffer
2) commit the working copy?
Comment 5 Jerome Lanneluc CLA 2004-03-22 06:47:47 EST
This stack trace is not the problem. If you let the exception be thrown it is 
caught in CompilationUnit.openParent(...).

However another JavaModelException is thrown later on:
Thread [main] (Suspended (breakpoint at line 804 in JavaModelManager))
	JavaModelManager.getPerProjectInfoCheckExistence(IProject) line: 804
	JavaProject.getPerProjectInfo() line: 1645
	JavaProject.getResolvedClasspath(boolean, boolean) line: 1756
	JavaProject.getResolvedClasspath(boolean) line: 1736
	JavaProject.buildStructure(OpenableElementInfo, IProgressMonitor, Map, 
IResource) line: 261
	JavaProject(Openable).generateInfos(Object, HashMap, IProgressMonitor) 
line: 169
	JavaProject(JavaElement).openWhenClosed(Object, IProgressMonitor) line: 
543
	JavaProject(JavaElement).getElementInfo(IProgressMonitor) line: 280
	JavaProject(JavaElement).getElementInfo() line: 266
	JavaProject.getJavaProjectElementInfo() line: 1381
	JavaProject.newNameLookup(ICompilationUnit[]) line: 2125
	JavaProject.newNameLookup(WorkingCopyOwner) line: 2139
	SearchableEnvironment.<init>(JavaProject, WorkingCopyOwner) line: 63
	JavaProject.newSearchableNameEnvironment(WorkingCopyOwner) line: 2154
	CompilationUnitProblemFinder.process(CompilationUnitDeclaration, 
ICompilationUnit, Parser, WorkingCopyOwner, IProblemRequestor, IProblemFactory, 
boolean, IProgressMonitor) line: 147
	CompilationUnit.buildStructure(OpenableElementInfo, IProgressMonitor, 
Map, IResource) line: 144
	CompilationUnit(Openable).generateInfos(Object, HashMap, 
IProgressMonitor) line: 169
	CompilationUnit(JavaElement).openWhenClosed(Object, IProgressMonitor) 
line: 543
	CompilationUnit.makeConsistent(boolean, IProgressMonitor) line: 943
	ReconcileWorkingCopyOperation.executeOperation() line: 56
	ReconcileWorkingCopyOperation(JavaModelOperation).run(IProgressMonitor) 
line: 700
	ReconcileWorkingCopyOperation(JavaModelOperation).runOperation
(IProgressMonitor) line: 739
	CompilationUnit.reconcile(boolean, boolean, WorkingCopyOwner, 
IProgressMonitor) line: 1050
	CompilationUnit.reconcile(boolean, WorkingCopyOwner, IProgressMonitor) 
line: 1062
	CompilationUnit.reconcile() line: 1027
	CompilationUnitDocumentProvider.commitWorkingCopy(IProgressMonitor, 
Object, CompilationUnitDocumentProvider$CompilationUnitInfo, boolean) line: 870
	CompilationUnitDocumentProvider$2.execute(IProgressMonitor) line: 935
	CompilationUnitDocumentProvider$2
(TextFileDocumentProvider$DocumentProviderOperation).run(IProgressMonitor) 
line: 93
	WorkspaceModifyDelegatingOperation.execute(IProgressMonitor) line: 67
	WorkspaceModifyOperation$1.run(IProgressMonitor) line: 91
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, 
IProgressMonitor) line: 1559
	WorkspaceModifyDelegatingOperation(WorkspaceModifyOperation).run
(IProgressMonitor) line: 105
	WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress, 
ISchedulingRule) line: 72
	WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress) 
line: 62
	CompilationUnitDocumentProvider
(TextFileDocumentProvider).executeOperation
(TextFileDocumentProvider$DocumentProviderOperation, IProgressMonitor) line: 391
	CompilationUnitDocumentProvider(TextFileDocumentProvider).saveDocument
(IProgressMonitor, Object, IDocument, boolean) line: 611
	CompilationUnitEditor(AbstractTextEditor).performSave(boolean, 
IProgressMonitor) line: 3135
	CompilationUnitEditor.performSave(boolean, IProgressMonitor) line: 1171
	CompilationUnitEditor.doSave(IProgressMonitor) line: 1221
	EditorManager$10.run(IProgressMonitor) line: 982
	EditorManager$8.run(IProgressMonitor) line: 837
	ModalContext.runInCurrentThread(IRunnableWithProgress, 
IProgressMonitor) line: 302
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, 
Display) line: 252
	ApplicationWindow$1.run() line: 573
	BusyIndicator.showWhile(Display, Runnable) line: 84
	WorkbenchWindow(ApplicationWindow).run(boolean, boolean, 
IRunnableWithProgress) line: 570
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 1493
	EditorManager.runProgressMonitorOperation(String, 
IRunnableWithProgress, IWorkbenchWindow) line: 843
	EditorManager.savePart(ISaveablePart, IWorkbenchPart, boolean) line: 987
	WorkbenchPage.savePart(ISaveablePart, IWorkbenchPart, boolean) line: 
2448
	WorkbenchPage.saveEditor(IEditorPart, boolean) line: 2460
	SaveAction.run() line: 72
	SaveAction(Action).runWithEvent(Event) line: 881
	ActionHandler.execute(Object) line: 68
	Command.execute(Object) line: 160
	WorkbenchKeyboard.executeCommand(String, Event) line: 475
	WorkbenchKeyboard.press(List, Event, boolean) line: 891
	WorkbenchKeyboard.processKeyEvent(List, Event, boolean) line: 935
	WorkbenchKeyboard.filterKeySequenceBindings(Event) line: 568
	WorkbenchKeyboard.access$2(WorkbenchKeyboard, Event) line: 500
	WorkbenchKeyboard$1.handleEvent(Event) line: 256
	EventTable.sendEvent(Event) line: 82
	Display.filterEvent(Event) line: 705
	StyledText(Widget).sendEvent(Event) line: 809
	StyledText(Widget).sendEvent(int, Event, boolean) line: 834
	StyledText(Widget).sendEvent(int, Event) line: 819
	StyledText(Control).sendKeyEvent(int, int, int, int, Event) line: 1720
	StyledText(Control).sendKeyEvent(int, int, int, int) line: 1716
	StyledText(Control).WM_CHAR(int, int) line: 3041
	StyledText(Control).windowProc(int, int, int, int) line: 2944
	Display.windowProc(int, int, int, int) line: 2962
	OS.DispatchMessageW(MSG) line: not available [native method]
	OS.DispatchMessage(MSG) line: 1438
	Display.readAndDispatch() line: 2100
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1448
	Workbench.runUI() line: 1419
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 257
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 139
	IDEApplication.run(Object) line: 90
	PlatformActivator$1.run(Object) line: 260
	EclipseStarter.run(Object) line: 173
	EclipseStarter.run(String[], Runnable) line: 106
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	Main.basicRun(String[]) line: 305
	Main.run(String[]) line: 729
	Main.main(String[]) line: 713

We attempt to compute the problems of the working copy that is not in a Java 
project.
Comment 6 Jerome Lanneluc CLA 2004-03-22 07:13:09 EST
Fixed CompilationUnit.buildStructure(...) to not compute problems if its 
project doesn't have the Java nature.

Added regression test WorkingCopyNotInClasspath.testReconcileSimpleProject()
Comment 7 Frederic Fusier CLA 2004-03-24 10:57:06 EST
Verified for 3.0 using build I200403240800.