This page is no longer maintained — Please continue to the home page at www.scala-lang.org

errors renaming a scala object in eclipse

1 reply
merlin-hst
Joined: 2009-10-14,
User offline. Last seen 2 years 30 weeks ago.

Hi,

I'm not sure if this is the right place to ask it, but I've found a bug (?) when I try to rename a scala object in eclipse, even after the latest update:

First I created a new scala object named 'TestScala' using the eclipse wizard and added the following lines to it:

object TestScala extends Application {
println("Hello Scala World")
}

Now I've renamed the compilation unit TestScala to TestScala1 using the refactor -> rename function in the Package Exlorer.
After that I also would like to rename the object TestScala to TestScala1.

In the opening rename wizard window the 'new name' is provided as TestScala$ which is a little bit annoying - at least for 'old' java developers ;)
When I now change the name to TestScala1$ I'm getting a warning about the unusual '$' sign in the name and if I ignore it the whitespace between the object name and the 'extends' keyword is removing. So the line 'object TestScala extends Application' will become 'object TestScala1$extends Application' which is of course wrong.
And if I remove the '$' sign from the new name I'm getting an error that the 'compilation unit TestScala1.scala' already exists. Just changing the name manually in the editor works fine. But what about the references to this object ?

I've done all that actions from the context menu in the Package Explorer. But when I try to select the object name in the editor view and then call 'rename' from the context menu nothing happens and in the eclipse error log I see the following entry:

java.lang.NullPointerException
at org.eclipse.jdt.internal.corext.dom.NodeFinder.perform(NodeFinder.java:51)
at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.start(RenameLinkedMode.java:207)
at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:187)
at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.doRun(RenameJavaElementAction.java:141)
at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:123)
at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:115)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:278)
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.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
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:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
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:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

Lothar

_______________________________________________________________
Neu: WEB.DE DSL bis 50.000 kBit/s und 200,- Euro Startguthaben!
http://produkte.web.de/go/02/

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: errors renaming a scala object in eclipse

On Mon, Oct 19, 2009 at 11:30 AM, Lothar Krenzien wrote:
> I'm not sure if this is the right place to ask it, but I've found a bug (?)

Yup, that's a bug ... could you create a ticket for it in Trac ... thanks.

Cheers,

Miles

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland