我希望有人可以帮助我解决我在特定项目中使用 Eclipse 中的 java 搜索功能时遇到的问题。
在一个特定项目上使用 java 搜索时,我收到一条错误消息Class file name must end with .class
(请参阅下面的堆栈跟踪)。这似乎并没有发生在所有项目上,只是一个特定的项目,所以也许我应该尝试重建一些东西?
我已经尝试过Project -> Clean
......并关闭 Eclipse,删除所有构建的类文件并重新启动 Eclipse 无济于事。
我在谷歌上找到的唯一参考是http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx,但不幸的是他的解决方案(关闭,删除类文件,重新启动)对我不起作用。
如果有人可以建议尝试一些东西,或者我可以收集更多信息来帮助追踪它,我将非常感谢您的指点。
Version: 3.4.0
Build id: I20080617-2000
也刚刚找到这个线程 - http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html - 这表明当项目名称包含句点时可能会出现同样的问题。不幸的是,我的设置并非如此,所以我仍然卡住了。
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.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
感谢 McDowell,关闭和打开项目似乎已经修复了它(至少现在是这样)。