Project: JDT
Bug 137756 Quickfix causes Java Model Exception: Project cannot reference itself
Reported: 2006-04-20 11:39:13 | Status: resolved fixed

3.2RC1 In a plug-in I'm trying to reference an internal class. Using the AntBuilderTabGroup class as a guide (from org.eclipse.ant.ui), I have this line in my java file: import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab; Eclipse complains "The import org.eclipse.ui.externaltools" cannot be resolved, so I clicked on the error and pressed Ctrl+1. The quick fix suggested "Add library 'External Plug-ins' to build path of 'com.sas.tools.sds'", so I selected that and got an error dialog: Quick Fix An exception occurred while applying the quick fix. Reason: Project cannot reference itself: com.sas.tools.sds The traceback from the .log file is copied below. eclipse.buildId=I20060413-1718 java.version=1.6.0-beta2 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Framework arguments: Command-line arguments: -os win32 -ws win32 -arch x86 -data c:\Development\eclipse\workspace Error Thu Apr 20 11:16:35 EDT 2006 Internal Error Java Model Exception: Java Model Status [Project cannot reference itself: com.sas.tools.sds] at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:775) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3011) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3027) at org.eclipse.jdt.internal.corext.refactoring.changes.AddToClasspathChange.perform(AddToClasspathChange.java:70) at org.eclipse.jdt.internal.ui.text.correction.ChangeCorrectionProposal.performChange(ChangeCorrectionProposal.java:119) at org.eclipse.jdt.internal.ui.text.correction.ChangeCorrectionProposal.apply(ChangeCorrectionProposal.java:81) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:726) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:672) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$26(CompletionProposalPopup.java:668) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$5.widgetDefaultSelected(CompletionProposalPopup.java:538) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:97) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3346) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) 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:589) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/changes/AddToClasspathChange.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ReorgCorrectionsSubProcessor.java