Bug 75894 - [implementation] 'Internal Error' if delete all Java Classes from Java Project
Summary: [implementation] 'Internal Error' if delete all Java Classes from Java Project
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
: 80999 86341 88055 89909 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-08 09:31 EDT by Magda Bologa CLA
Modified: 2020-04-24 01:42 EDT (History)
6 users (show)

See Also:


Attachments
Errors while deleting the platform.doc projects (8.71 KB, text/plain)
2005-06-23 11:07 EDT, Paul Webster CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magda Bologa CLA 2004-10-08 09:31:04 EDT
Tested with Eclipse 3.0.1.1.
using Eclipse Java Development Tools
Version: 3.0.1.1
Build id: 200409301141

Steps:
1. Create a  Java Project (JavaPJ) and add two java Classes C1 and C2, C1 being 
Parent Class of C2( create them under Project root - this will create the .java 
files under default package)  - use Java Class wizard to create java classes
So C2.java  and C1.java will have the code below:
public class C2 extends C1 {

}

C1. java will have as below:
public class C1 {

}
------------------------------------------------------------

3.  With both .java files opened in default editor, Select both java files 
C1.java amd C2.java in Project Explorer View, r-click on it and perform a 
Delete Operation.

4. Confirm Deletion.
Actual:  both .java files will get deleted from Package Explorer View, BUT you 
will get exceptions in log (see below)
Expected: no errors

Error LOg:

!ENTRY org.eclipse.jdt.ui 4 10001 Oct 08, 2004 09:03:21.93
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [C2.java [in <default> [in <project 
root> [in JavaPJ]]] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException
(Unknown Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(Unknown 
Source)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(Unknown 
Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.getTypes(Unknown 
Source)
	at 
org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.getMainType
(Unknown Source)
	at 
org.eclipse.jdt.ui.actions.ExtractInterfaceAction.getSingleSelectedType(Unknown 
Source)
	at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.canEnable(Unknown 
Source)
	at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.selectionChanged
(Unknown Source)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(Unknown Source)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(Unknown Source)
	at org.eclipse.jface.viewers.Viewer$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown 
Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Unknown 
Source)
	at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProbl
emTreeViewer.handleInvalidSelection(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection
(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$5.run
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$7.run
(Unknown Source)
	at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown 
Source)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown 
Source)
	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
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 Oct 08, 2004 09:03:21.293
!MESSAGE C2.java [in <default> [in <project root> [in JavaPJ]]] does not exist

!ENTRY org.eclipse.jdt.ui 4 10001 Oct 08, 2004 09:03:21.524
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [C2.java [in <default> [in <project 
root> [in JavaPJ]]] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException
(Unknown Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(Unknown 
Source)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(Unknown 
Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.getTypes(Unknown 
Source)
	at 
org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.getMainType
(Unknown Source)
	at 
org.eclipse.jdt.ui.actions.ConvertNestedToTopAction.getSingleSelectedType
(Unknown Source)
	at org.eclipse.jdt.ui.actions.ConvertNestedToTopAction.canEnable
(Unknown Source)
	at org.eclipse.jdt.ui.actions.ConvertNestedToTopAction.selectionChanged
(Unknown Source)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(Unknown Source)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(Unknown Source)
	at org.eclipse.jface.viewers.Viewer$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown 
Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Unknown 
Source)
	at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProbl
emTreeViewer.handleInvalidSelection(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection
(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$5.run
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$7.run
(Unknown Source)
	at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown 
Source)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown 
Source)
	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
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 Oct 08, 2004 09:03:21.634
!MESSAGE C2.java [in <default> [in <project root> [in JavaPJ]]] does not exist

!ENTRY org.eclipse.jdt.ui 4 10001 Oct 08, 2004 09:03:21.674
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [C2.java [in <default> [in <project 
root> [in JavaPJ]]] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException
(Unknown Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(Unknown 
Source)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(Unknown 
Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren(Unknown Source)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(Unknown 
Source)
	at org.eclipse.jdt.internal.core.CompilationUnit.getTypes(Unknown 
Source)
	at 
org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.getMainType
(Unknown Source)
	at org.eclipse.jdt.ui.actions.UseSupertypeAction.getSingleSelectedType
(Unknown Source)
	at org.eclipse.jdt.ui.actions.UseSupertypeAction.canEnable(Unknown 
Source)
	at org.eclipse.jdt.ui.actions.UseSupertypeAction.selectionChanged
(Unknown Source)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(Unknown Source)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(Unknown Source)
	at org.eclipse.jface.viewers.Viewer$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown 
Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Unknown 
Source)
	at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProbl
emTreeViewer.handleInvalidSelection(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection
(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at org.eclipse.jface.viewers.AbstractTreeViewer.remove(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$5.run
(Unknown Source)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$7.run
(Unknown Source)
	at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown 
Source)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown 
Source)
	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
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 Oct 08, 2004 09:03:21.804
!MESSAGE C2.java [in <default> [in <project root> [in JavaPJ]]] does not exist
Comment 1 Jerome Lanneluc CLA 2004-11-04 06:20:36 EST
Refactoring is attempting to get the types of a compilation unit that doesn't
exist any longer.

Moving to JDT UI for comment
Comment 2 Dirk Baeumer CLA 2004-11-04 06:28:31 EST
Problem is that handleInvalidSelection creates a new selection which is again
invalid. Have to check how to avoid this.
Comment 3 Dirk Baeumer CLA 2004-12-12 13:55:10 EST
Actually the problem is more compilcated than that. What happens is the following:

- deleting the two CUs causes a refresh
- since the editors are open the package still contains the primary working  
  copies
- the package explorer refreshes the package and shows the primary workings  
  copies
- the editor infra structure interprets the delete delta and closes the editors
- this discards the working copies
- the package explorer react and removes the primary working copies.
- since the delta isn't batch on after the other is removed.
- after removing the first one the package explorer tries to restore the 
  selectionto only cover the second one. This causes the exception.

Fix is non trivial and has to wait for M5.
Comment 4 Dirk Baeumer CLA 2004-12-15 04:32:34 EST
*** Bug 80999 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Baeumer CLA 2005-02-24 07:02:29 EST
*** Bug 86341 has been marked as a duplicate of this bug. ***
Comment 6 Dirk Baeumer CLA 2005-03-15 13:09:32 EST
*** Bug 88055 has been marked as a duplicate of this bug. ***
Comment 7 Dirk Baeumer CLA 2005-03-31 18:11:58 EST
*** Bug 89909 has been marked as a duplicate of this bug. ***
Comment 8 Dirk Baeumer CLA 2005-05-01 13:21:11 EDT
The actual root of the fact that the package explorer receives to separate
deltas for the working copy disposal is that the editor framework closes each
editor separately using a async exec (see AbstractTextEditor#close). The package
explorer has no change to map these two separate event back onto one event.

Possible solutions:

- the editor framework only post one async exec disposing all editors. This 
  would again give the package explorer the change to see that more tham one 
  file got deleted. Dani, any change that this can happen ?

- the package explorer handles the invalid selection. This seems inappropriate
  since the PE should never touch the new selection

- the actions handle the case of not existing CUs in selection changes more
  gracefully.
Comment 9 Dirk Baeumer CLA 2005-05-09 06:37:53 EDT
Daniel, I debugged it again and the problem comes from the following affect:

- the closing of the editor is done using async exec
- since the event loop is active when deleteing CUs (its executed in a modal
  context thread) the closing takes place in parallel to the event interpretation
  in the package explorer. So the package explorer interprests a delta that
  describes the state of the workspace that doesn't reflect the current state

The right solution to the problem would be to not async exec the closing of the
editor. It should be put into a job with a scheduling rule that only allows
running the job after the current operation has finish. 

I relases a workaround fix in JDT/UI. Moving to text for further consideration
in 3.2
Comment 10 Paul Webster CLA 2005-06-23 11:07:32 EDT
Created attachment 23854 [details]
Errors while deleting the platform.doc projects

In 3.1 N20050622-0100, I get the same error when deleting platform.doc.user and
platform.doc.isv (I'm assuming it's the same problem, so I'll just throw my hat
in here :-)

eclipse.buildId=N20050622-0010
java.version=1.4.2_08
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86

PW
Comment 11 Dani Megert CLA 2005-06-23 11:25:07 EDT
Paul, please file a separate bug this is unrelated to the editor.
Comment 12 Paul Webster CLA 2005-06-23 11:34:38 EDT
Done, I've moved my problems over to bug 101475

PW
Comment 13 Dani Megert CLA 2006-04-04 04:55:30 EDT
Not for 3.2. There's no immediate benefit and the risk for such a fix is too high at this point.
Comment 14 Eclipse Genie CLA 2020-04-24 01:42:04 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.