Hi everyone,
I'm trying to report long-standing annoyances encountered when using
the ScalaIDE in the interest of improving it. Here's one that's
fairly easy to reproduce:
Say I have two classes defined in the same package and the same file:
File: SomeOtherClass.scala
Activating the rename-class refactoring via alt-shift-r on either the
MyClass constructor call or the MyClass defintion does the right
thing: references to MyClass are renamed everywhere in this file.
Say the affected classes are in the same package, but two different files:
File MyClass.scala:
File SomeOtherClass.scala:
Here, renaming from the MyClass definition works and correctly renames
the .scala file; renaming from the MyClass constructor call works but
DOESN'T rename the .scala file.
Now say the affected classes are in different packages and different
files:
File MyClass.scala:
File SomeOtherClass.scala:
Here, renaming from the MyClass constructor call has no apparent
effect, but renaming from the MyClass definition DOES work, and DOES
rename the relevant .scala file.
I just tested these scenarios in a minimal Scala project created with
the latest ScalaIDE milestone, running in Eclipse Kepler SR1.
I'm trying to report long-standing annoyances encountered when using
the ScalaIDE in the interest of improving it. Here's one that's
fairly easy to reproduce:
Say I have two classes defined in the same package and the same file:
File: SomeOtherClass.scala
package com.example.foo
class MyClass(some: Int, params: Int)
class SomeOtherClass {
def blerg {
val someClass = new MyClass(123, 456)
println(someClass)
}
}
Activating the rename-class refactoring via alt-shift-r on either the
MyClass constructor call or the MyClass defintion does the right
thing: references to MyClass are renamed everywhere in this file.
Say the affected classes are in the same package, but two different files:
File MyClass.scala:
package com.example.foo
class MyClass(some: Int, params: Int)
File SomeOtherClass.scala:
package com.example.foo
class SomeOtherClass {
def blerg {
val someClass = new MyClass(123, 456)
println(someClass)
}
}
Here, renaming from the MyClass definition works and correctly renames
the .scala file; renaming from the MyClass constructor call works but
DOESN'T rename the .scala file.
Now say the affected classes are in different packages and different
files:
File MyClass.scala:
package com.example.bar.baz
class MyClass(some: Int, params: Int)
File SomeOtherClass.scala:
package com.example.foo
import com.example.bar.baz.MyClass
class SomeOtherClass {
def blerg {
val someClass = new MyClass(123, 456)
println(someClass)
}
}
Here, renaming from the MyClass constructor call has no apparent
effect, but renaming from the MyClass definition DOES work, and DOES
rename the relevant .scala file.
I just tested these scenarios in a minimal Scala project created with
the latest ScalaIDE milestone, running in Eclipse Kepler SR1.
Leave a comment
on 2014-06-05 05:22 *
By huitseeker
Assigned to set to Mirko Stocker
Status changed from New to Accepted
Reproduced.
Ticket assignment reverted due to inactivity.
@clintgilbert thanks for the detailed report. I can reproduce the class file not being renamed in both examples. Here is a minimal project to reproduce this bug: https://github.com/mlangc/scala-ide-experiments/tree/class-renaming-1001928. I'll see what I can do.
I think I have a fix:
https://github.com/scala-ide/scala-refactoring/pull/80
https://github.com/scala-ide/scala-ide/pull/915
Note that this two pull requests depend on each other...
https://github.com/scala-ide/scala-refactoring/pull/80
https://github.com/scala-ide/scala-ide/pull/915
Note that this two pull requests depend on each other...
Rename source files when the associated classes are renamed
This change is closely related to
scala-ide/scala-refactoring@21e3ccf59123824a22b6d60e4bb991ccc58d2de9
Fixes #1001928
Branch: master
Commit: scala-ide:c519d15a7b
This change is closely related to
scala-ide/scala-refactoring@21e3ccf59123824a22b6d60e4bb991ccc58d2de9
Fixes #1001928
Branch: master
Commit: scala-ide:c519d15a7b
No file chosen
You have an empty file field. Please select or remove it.
Name | Size |
---|