Bug 23361 - Java Model Exception when renaming a compilation unit
Summary: Java Model Exception when renaming a compilation unit
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Dirk Baeumer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 23785 24584 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-09-10 10:28 EDT by Luc Bourlier CLA
Modified: 2002-10-09 12:49 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luc Bourlier CLA 2002-09-10 10:28:42 EDT
Build 200209031019

I have a special test case which generates a Java Model Exception, a funny thing
(for me) it's I can't reproduce it two times with the same compilation unit
names, even if I stop and restart Eclipse.

1. Create the two following compilation units :

public class TestCompiler_1 {
  public static void main(String[] args) {
    TestCompiler_2.foo();
  }
}
------------
public class TestCompiler_2 {
  public static void foo() {
    System.out.println("test");
  }
}

2. Export TestCompiler_2 in a jar file.
3. Add the created jar file in the classpath.
4. Rename TestCompiler_2 to TestCompiler_2_src, in the "Rename compilation unit"
dialog, uncheck "Update references to renamed element".

The following stack trace is written in the log file :

!SESSION Sep 10, 2002 09:11:55.521 ---------------------------------------------
java.version=1.4.1-beta
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments: -dev bin -data /home/lbourlie/workspaces/selfhost/ -os
linux -ws gtk -arch x86
!ENTRY org.eclipse.jdt.ui 4 1 Sep 10, 2002 09:11:55.542
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [TestCompiler_2.java does not exist.]
        at
org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:500)
        at
org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:254)
        at
org.eclipse.jdt.internal.core.CompilationUnit.getCorrespondingResource(CompilationUnit.java:412)
        at
org.eclipse.jdt.ui.actions.ShowInNavigatorViewAction.getResource(ShowInNavigatorViewAction.java:175)
        at
org.eclipse.jdt.ui.actions.ShowInNavigatorViewAction.getResource(ShowInNavigatorViewAction.java:154)
        at
org.eclipse.jdt.ui.actions.ShowInNavigatorViewAction.selectionChanged(ShowInNavigatorViewAction.java:93)
        at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged(SelectionDispatchAction.java:181)
        at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged(SelectionDispatchAction.java:176)
        at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147)
        at
org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1155)
        at
org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:904)
        at
org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage.select(JavaOutlinePage.java:854)
        at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.synchronizeOutlinePageSelection(CompilationUnitEditor.java:1309)
        at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$3.run(CompilationUnitEditor.java:1346)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31)
        at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:95)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1356)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1226)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1256)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:1239)
        at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:775)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
        at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
!ENTRY org.eclipse.jdt.core 4 969 Sep 10, 2002 09:11:55.555
!MESSAGE TestCompiler_2.java does not exist.
Comment 1 Jerome Lanneluc CLA 2002-09-19 10:13:27 EDT
*** Bug 23785 has been marked as a duplicate of this bug. ***
Comment 2 Jerome Lanneluc CLA 2002-09-20 07:07:05 EDT
Looks like the known problem in UI that tries to find out which actions are 
available on volatile elements.

Moving to JDT-UI.
Comment 3 Dirk Baeumer CLA 2002-10-08 12:08:05 EDT
Added check if the thrown JavaModelExcption is a NotPresentException. If so we 
don't have a corresponding IResource and the action gets disabled.
Comment 4 Dirk Baeumer CLA 2002-10-09 12:49:03 EDT
*** Bug 24584 has been marked as a duplicate of this bug. ***