Bug 268933 - [index] "Class file name must end with .class" Error when renaming java resource
Summary: [index] "Class file name must end with .class" Error when renaming java resource
Status: CLOSED DUPLICATE of bug 286379
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-17 05:39 EDT by Oyvind Johansen CLA
Modified: 2009-11-11 14:09 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oyvind Johansen CLA 2009-03-17 05:39:12 EDT
When trying to rename a Java class using the rename refactoring dialog I get a Dialog box saying "Class file name must end with .class" which blocks the rename operation. 

Reproduction: 
1. Select a Java file in the Package Explorer
2. rightclick, select Refactor then Rename
3. Enter a new name and click Next

OS: Windows XP Service Pack 3 32 Bit

Plugins of note are Subclipse SVN client in addition to what Eclipse for J2EE development ships with. 

-- Error Details --
Date: Tue Mar 17 10:20:57 CET 2009
Message: Internal Error
Severity: Error
Plugin: org.eclipse.ltk.ui.refactoring
Session Data:
eclipse.buildId=M20090211-1700
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=no_NO
Command-line arguments:  -os win32 -ws win32 -arch x86


Exception Stack Trace:
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:317)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.createChange(RefactoringWizard.java:584)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.computeUserInputSuccessorPage(RefactoringWizard.java:423)
	at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.computeSuccessorPage(UserInputWizardPage.java:75)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardInputPage.getNextPage(RenameTypeWizardInputPage.java:187)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.nextOrPreviewPressed(RefactoringWizardDialog2.java:488)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.access$0(RefactoringWizardDialog2.java:485)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2$3.widgetSelected(RefactoringWizardDialog2.java:711)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:144)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:156)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:37)
	at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:60)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter.activate(RenameUserInterfaceStarter.java:31)
	at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:160)
	at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:117)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startRenameRefactoring(RefactoringExecutionStarter.java:437)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:194)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:106)
	at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:108)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:472)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:882)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:571)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:512)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:127)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1184)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036)
	at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1653)
	at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:4122)
	at org.eclipse.swt.widgets.Tree.WM_KEYDOWN(Tree.java:5923)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3818)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5791)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4541)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2371)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3420)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Caused by: java.lang.IllegalArgumentException: Class file name must end with .class
	at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182)
	at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:109)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1177)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:223)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:506)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:551)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:142)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:129)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.initializeReferences(RenameTypeProcessor.java:594)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.doCheckFinalConditions(RenameTypeProcessor.java:522)
	at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor.doCheckFinalConditions(RenameCompilationUnitProcessor.java:329)
	at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:85)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Frederic Fusier CLA 2009-03-17 06:30:02 EDT
There's something in your workspace which makes the indexer think that some files are binary classes belonging to a jar file although these are sources.

We already fixed in the past as similar issue when projects names ended by '.jar' (see bug 138184), but it seems that your workspaces set-up has an another annoying use case which screwed up our indexer...

Would it be possible to create a small test case and attach it to this bug to help me to figure out what happen and have a chance to reproduce the exception?

TIA
Comment 2 Oyvind Johansen CLA 2009-03-17 06:54:53 EDT
The project I'm working on is both old and complex so it may take a while to get a tiny test up and running but I will report back here when I find out more about what causes the problem.
Comment 3 Oyvind Johansen CLA 2009-03-17 07:25:12 EDT
Update: I have now succesfully removed the problem by looking at the differences in the new project I created and the old one.

First, I found a file named "settings/org.eclipse.wst.validation.prefs" which was not created in the new project, so I deleted it in the old one.
For reference, this is the content of the deleted file:
===BEGIN FILE====
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;org.eclipse.jst.jsp.core.internal.validation.JSPELValidator;org.eclipse.wst.html.internal.validation.HTMLValidator;
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.1.0.v200606130645
eclipse.preferences.version=1
===END FILE===

Second, I saw that the file "org.eclipse.wst.common.project.facet.core.xml" was not set up for javascript support so I added it in in addition to updating the Java runtime version and JSP servlet versions. 

old:
<runtime name="Apache Tomcat v5.5"/>
  <fixed facet="jst.java"/>
  <fixed facet="jst.web"/>
  <installed facet="jst.web" version="2.4"/>
  <installed facet="jst.java" version="5.0"/>
  
new:
<runtime name="Apache Tomcat v5.5"/>
  <fixed facet="jst.java"/>
  <fixed facet="jst.web"/>
  <installed facet="jst.java" version="6.0"/>
  <installed facet="jst.web" version="2.4"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  
 What any of this did to suddenly repair anything I might never know, but at least that fixed my problem. I Hope the information I provided help in finding some obscure errors or something. 
Comment 4 Ömer Yildiz CLA 2009-03-22 11:53:37 EDT
I've experienced the same problem. Moving my projects to a newly created workspace made the error disappear.
Comment 5 Frederic Fusier CLA 2009-03-23 04:49:21 EDT
(In reply to comment #4)
> I've experienced the same problem. Moving my projects to a newly created
> workspace made the error disappear.
> 
Did you also have J2EE plugins installed?
Comment 6 Ömer Yildiz CLA 2009-03-23 04:52:51 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > I've experienced the same problem. Moving my projects to a newly created
> > workspace made the error disappear.
> > 
> Did you also have J2EE plugins installed?
> 

No, just the latest Eclipse Classic SDK, EMF SDK and GMF SDK. The faulty workspace is older than my eclipse installation, though.
Comment 7 Frederic Fusier CLA 2009-03-26 05:59:32 EDT
*** Bug 269820 has been marked as a duplicate of this bug. ***
Comment 8 Sam Mesh CLA 2009-04-03 14:22:25 EDT
Bug 218987 and bug 268933 seems to be related, how this is usually expressed in bugzilla?
Comment 9 Frederic Fusier CLA 2009-06-19 04:02:37 EDT
(In reply to comment #8)
> Bug 218987 and bug 268933 seems to be related, how this is usually expressed in
> bugzilla?
> 
Usually, we set bugs as duplicate when they are similar and Depends on/Blocks when there's a dependency between them... But in this case, bug 218987 is a duplicate of bug 138184 which has been fixed for 3.4M2.

For this current bug, as I said in comment 1, the problem has a different origin even if the error message is the same because bug 218987 is already fixed in 3.4.2...
Comment 10 Frederic Fusier CLA 2009-06-19 04:04:23 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > I've experienced the same problem. Moving my projects to a newly created
> > > workspace made the error disappear.
> > > 
> > Did you also have J2EE plugins installed?
> > 
> 
> No, just the latest Eclipse Classic SDK, EMF SDK and GMF SDK. The faulty
> workspace is older than my eclipse installation, though.
> 
Are they Ganymede ones? More precisely, could you give us the eclipse version?
Comment 11 Frederic Fusier CLA 2009-06-19 04:06:04 EDT
Reducing the severity as both reporters have fixed the problem (see comment 3 and comment 4)
Comment 12 Olivier Thomann CLA 2009-11-11 14:09:17 EST
Closing as a duplicate of bug 286379.
Try 3.6M3 and report if you still get this issue.

*** This bug has been marked as a duplicate of bug 286379 ***