Question

I've been using the newest version of the groovy eclipse plugin (for eclipse 3.4) and I noticed that when I run organize imports on the file, it actually removes some of the imports that I need. It seems to remove the ones in my project, not java.* imports. Any ideas why?

thanks, Jeff

Was it helpful?

Solution

This functionality has been fixed in the 3.5 stream of the Groovy Eclipse plugin. Or at least it is fixed when running organize imports from the editor. So, running Ctrl-Shift-O inside the editor, or running format after save will work. However, running Organize imports from the package explorer or any other view will not.

The reason for this is that we need a way to hook in special groovy functionality. When running organize imports from inside the editor, this is possible to do. Hwoever, we have not figured out a general way to co-opt JDT's organize imports when running outside the editor. It is worth raising a bug for this. http://jira.codehaus.org/greclipse

Before the release of 2.0.0M1 (before the end of September), we will port this functionality back to 3.4, but we are finding that not many people are using 3.4, so we have not kept it up to date with the 3.5 stream.

OTHER TIPS

That may be related to the underlying JDT "organize import" mechanism, which does have some issue in eclipse3.4:

  • bug 87950: issue with type inferencing -- which is important with groovy, combined with
  • bug 235253: Organize imports removes needed import statement -- unresolved in 3.4.
  • bug 252379: Organize imports deletes needed static import -- unresolved in 3.4(.1)

Can you make the Groovy plugin work in eclipse3.5, and if yes, do you still have the same issue?
If you do, one of those bugs need to be completed/reactivated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top