Grails Controller Classes "Already Exists" (But It Doesn't)

Hi,

Today I started noticing a peculiar bug when editing Groovy classes that were Grails controllers (but no other classes, as far as I can tell).

Specifically:

1) I open a Grails controller class source file and, once inspection is complete, I get a green or yellow status box at the top of the right gutter.

2) I then make any change to the file, including simply selecting some text, copying it and pasting back on top of itself, and the class name gets a red underscore with the diagnostic "Class '...' already exists in ']]>'".

I have InspectorGroovy installed, so perhaps there's an interaction there.

IDEA: #7573
JetGroovy: 0.1.12796
InspectorGroovy: 0.1
JVM: Sun 1.6.0_03
OS: Linux


Randall Schulz

0
10 comments
Avatar
Permanently deleted user

I fixed the bug that looks suspiciously alike the one you describe. It is however only triggered for the case of two or more modules in your project. Is it the case for you?

Eugene.

0

Yes. I have two modules, one holding the application itself and another for generic programming utilities and such.

RRS

0
Avatar
Permanently deleted user

OK, then the bug has been fixed indeed, we'll update the plugin version tomorrow.

Eugene.

0

Great. Thank you.

RRS

0

Hi,

I've upgraded JetGroovy (twice so far today) and am now running 0.1.12856. The spurious "... already exists ..." error is still present, though for some reason, now it's happening only on my domain classes, not on controller classes.

Randall Schulz

0

I just noticed another odd symptom: Two listings in the Project viewer for the same Groovy source file. I've attached a screen snapshot showing this.

The directory in question looks like this (via "ls -l"):



Attachment(s):
DuplicatedDomainClass.png
0
Avatar
Permanently deleted user

Strange. It could be caused by old caches being not wiped automatically, though I advanced cache version number. Could you please delete groovy caches in your system dir manually and see if it helps?

Eugene.

0

Hello, Eugene,

I shut down, cleared the cache and restarted, for what it's worth (read on).

I think I know what happened and I can now recreate and alleviate this symptom at will. It's much less serious (it borders on the cosmetic), but still probably something you should look into.

Here's what happened: Unbeknownst to me, I apparently hit a key while the insertion point was at the very top of my Grails domain class source file (outside the header comment I routinely place there). With this extra charcter in the file, the spurious green G icon with the same name as the file with the bogus character (re-)appears along with the "... already defined ..." error. When I then remove that errant character, everything goes back to normal (the extra class listing and the error both disappear).

Still "strange" but not really a big problem.


Randall Schulz

0
Avatar
Permanently deleted user

This is not a problem at all. When you typed the symbol, you essentially made a second class (with file name, that I guess is the same as the name of the class you already have) that contains a single character script! So groovyc would complain for it too with its more verbose but better worded message.

Eugene.

0
Avatar
Permanently deleted user

Of course when I said class, I mean class generated for the script.

0

Please sign in to leave a comment.