0

From time to time a source file somehow gets two class files, like this: Error screenshot

Trying to delete either class file gives an error. Grails clean and Eclipse Clean Project don't help. Usually I have to delete the source file and re-create to get rid of the extra class file, but that didn't work last time. Thoughts?

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
Josh Diehl
  • 2,913
  • 2
  • 31
  • 43
  • 1
    Actually, I just identified the root cause, which was a method def placed outside of the Class closing brace. Still, seems odd STS would generate two types as a result of a syntax error. – Josh Diehl May 02 '12 at 18:22
  • 3
    That's probably a Groovy thing, since you can define multiple classes in one source file, and you can have code without an explicit class declaration and it will wrap it in one for you. – Burt Beckwith May 02 '12 at 18:35
  • That sounds logical. Care to post an answer so I can accept? – Josh Diehl May 03 '12 at 02:27
  • 1
    That's exactly what is going on. It's not really an STS/Eclipse bug, except that perhaps the error message could be more understandable. However, since Groovy-Eclipse gets all (or most) error messages straight from the groovy compiler, this pushes any appropriate change back to the compiler. – Andrew Eisenberg May 03 '12 at 19:58

1 Answers1

0

See Burt Beckwith's comment for solution (wish he had made it an answer!).

Josh Diehl
  • 2,913
  • 2
  • 31
  • 43