Bug 52355 - Not present exception trying to create a class in excluded package
Summary: Not present exception trying to create a class in excluded package
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-18 08:28 EST by Philipe Mulet CLA
Modified: 2004-03-25 07:58 EST (History)
0 users

See Also:


Attachments
patch (1.41 KB, patch)
2004-02-18 09:00 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2004-02-18 08:28:16 EST
Build 3.0 M7

Having following project (Crap) layout:
- src/             source folder excluding 'service/'
- src/service/     source folder excluding 'subx/'
         +- subx/
Try to create a class, using class creation wizard:
- source folder:  Crap/src/service
- package:        subx.p
- name:           X2

Got the following exception:

!ENTRY org.eclipse.jdt.ui 4 10001 Feb 18, 2004 14:12:26.320
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [X2.java [in subx.p [in src/service [in 
Crap]]] does not exist.]
        at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException
(JavaElement.java:525)
        at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:87)
        at org.eclipse.jdt.internal.core.Openable.generateInfos
(Openable.java:169)
        at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed
(JavaElement.java:536)
        at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:280)
        at org.eclipse.jdt.internal.core.Openable.open(Openable.java:368)
        at 
org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.executeOperation
(CommitWorkingCopyOperation.java:82)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:700)
        at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1567)
        at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation
(JavaModelOperation.java:744)
        at org.eclipse.jdt.internal.core.CompilationUnit.commitWorkingCopy
(CompilationUnit.java:281)
        at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType
(NewTypeWizardPage.java:1502)
        at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.finishPage
(NewClassCreationWizard.java:52)
        at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run
(NewElementWizard.java:93)
        at org.eclipse.jdt.internal.core.BatchOperation.executeOperation
(BatchOperation.java:34)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:700)
        at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1567)
        at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1586)
        at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3164)
        at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run
(WorkbenchRunnableAdapter.java:42)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:302)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252)
        at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:758)
        at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish
(NewElementWizard.java:100)
        at 
org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.performFinish
(NewClassCreationWizard.java:66)
        at org.eclipse.jface.wizard.WizardDialog.finishPressed
(WizardDialog.java:608)
        at org.eclipse.jface.wizard.WizardDialog.buttonPressed
(WizardDialog.java:321)
        at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:402)
        at org.eclipse.swt.widgets.TypedListener.handleEvent
(TypedListener.java:89)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2348)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2029)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:647)
        at org.eclipse.jface.window.Window.open(Window.java:627)
        at org.eclipse.jdt.internal.ui.wizards.AbstractOpenWizardAction.run
(AbstractOpenWizardAction.java:158)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:536)
        at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:488)
        at org.eclipse.jface.action.ActionContributionItem$5.handleEvent
(ActionContributionItem.java:420)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2348)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2029)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1550)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1526)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:265)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139)
        at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:47)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:257)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:279)
        at org.eclipse.core.launcher.Main.run(Main.java:742)
        at org.eclipse.core.launcher.Main.main(Main.java:581)
!ENTRY org.eclipse.jdt.core 4 969 Feb 18, 2004 14:12:26.320
!MESSAGE X2.java [in subx.p [in src/service [in Crap]]] does not exist.
Comment 1 Philipe Mulet CLA 2004-02-18 08:30:19 EST
Problem comes from the fact the commit operation does not switch to 'out of 
classpath' handling mode in this scenario. It should as soon as the unit 
primary is excluded, and working copy is not a primary wc(as in this case, we 
have special support in the model to open them).

Comment 2 Philipe Mulet CLA 2004-02-18 09:00:45 EST
Created attachment 7990 [details]
patch
Comment 3 Philipe Mulet CLA 2004-02-19 06:11:54 EST
Patch wasn't quite right. It also needs to check whether the root is on 
classpath, as exclusion check doesn't do it for free.

Fixed.
Comment 4 Jerome Lanneluc CLA 2004-02-19 08:17:13 EST
Test is needed. Make sure that test fails with CommitWorkingCopyOperation 1.44 
and that it passes with 1.45.
Comment 5 Jerome Lanneluc CLA 2004-02-19 13:02:35 EST
Added regression test WorkingCopyNotInClasspathTests.testCommitWorkingCopy2().
Comment 6 Frederic Fusier CLA 2004-03-25 07:58:54 EST
Verified for 3.0 using build I200403250010.