Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import not updated for nested enum class #379

Closed
mauromol opened this issue Nov 8, 2017 · 6 comments
Closed

Import not updated for nested enum class #379

mauromol opened this issue Nov 8, 2017 · 6 comments
Labels

Comments

@mauromol
Copy link

mauromol commented Nov 8, 2017

Consider the following Java class:

package test9;
public class Outer {
  public static enum MyEnum {
	  A, B;
  }
}

And the following Groovy class:

package test9
import test9.Outer.MyEnum
class GroovyClass {
	void doSomething() {
		MyEnum myEnum = MyEnum.A
	}
}

Now refactor Outer class and rename it to Outer2.
The following line in GroovyClass is not updated:
import test9.Outer.MyEnum

@eric-milles eric-milles added the bug label Nov 9, 2017
@eric-milles
Copy link
Member

Same issue exists if MyEnum is a class, trait or interface.

@eric-milles
Copy link
Member

ready to test

Fully- or partially-qualified names within the class or script body are a bit trickier. They may contain extra whitespaces and have some other complications that I did not deal with quite yet.

@mauromol
Copy link
Author

Hi Eric, I tested this with 2.9.2.xx-201711140121-e46 but the behaviour I see is not correct.

After renaming Outer to Outer2, this is what I expect:

package test9
import test9.Outer2.MyEnum
class GroovyClass {
	void doSomething() {
		MyEnum myEnum = MyEnum.A
	}
}

This is what I get instead:

package test9
import test9.Outer2.Outer2
class GroovyClass {
	void doSomething() {
		Outer2 myEnum = Outer2.A
	}
}

In other words, not only the Outer class name is changed in the import declaration, but also MyEnum is changed to Outer2 (both in the import declaration and in the method body), which is of course wrong.

@eric-milles
Copy link
Member

eric-milles commented Nov 14, 2017 via email

@eric-milles
Copy link
Member

ready to re-test

@mauromol
Copy link
Author

Seems to work fine now with 2.9.2.xx-201711150348-e46, thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants