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

Fully qualified type name inserted in field declaration instead of import + simple name (disregarding workspace preference) #866

Closed
mauromol opened this issue Apr 3, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@mauromol
Copy link

mauromol commented Apr 3, 2019

Follow-up of #862 (see discussion there).

Steps to repro:

  • start Eclipse (tested with 2018-12) on a brand new empty workspace
  • create a Groovy project
  • create this Groovy class:
package test50

class Test50 {
	
	String foo
	
	TreeNode|
}
  • invoke code assist at "|" and choose javax.swing.tree.TreeNode
  • the editor inserts the import statement and leaves the simple class name TreeNode at the declaration point; so far so good
  • remove the import and save the file, restoring its original state
  • import this workspace preferences file: https://www.dropbox.com/s/uqmmlxfibob2wbj/Eclipse%20preferences%20-%20DARK.epf?dl=1
  • when requested, restart the Eclipse IDE
  • after restart, go to Test50 class
  • try to invoke the code assist at "|" as before
  • the editor may say that some kind of problem with code assist occurred: not sure why (any idea?)
  • click to "restore defaults"
  • at this point, invoking code assist again may not work any more (why?)
  • close the Test50 class and open it again
  • try to invoke code assist at "|" again
  • now, the fully qualified name javax.swing.tree.TreeNode is inserted at the declaration point, instead of the import statement, although "Add import instead of qualified name" workspace preference related to Content Assist is checked
  • at this point, this faulty behaviour will always occur

If you still can't reproduce in this way, please tell me: I may provide my whole Eclipse installation (for Windows x64).

@eric-milles
Copy link
Member

Okay, got it. When you complete on the full type name, the import rewriter is finding a conflict with the recovery generated field/property "java.lang.Object TreeNode". If you remove even one character, the import should be inserted. I'll see what I can do about this issue.

@eric-milles
Copy link
Member

Ready to test

@mauromol
Copy link
Author

I verified that it works correctly with 3.4.0.v201904092237-e1812, 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