2

Below is a snippet from a working code taken from the Groovy in Action book. As you see below, IntelliJ sees it as error.

Why?

See picture below:

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Askar
  • 5,784
  • 10
  • 53
  • 96
  • I've known IntelliJ's support with Groovy/Griffon to be shaky. Double check on their [bug tracker](http://youtrack.jetbrains.com/issues) that there's not an open bug for this already, and if there *is*, report your findings, too. – Makoto Apr 15 '13 at 03:35
  • 1
    New ticket was created [IDEA-105357](http://youtrack.jetbrains.com/issue/IDEA-105357). – Askar Apr 15 '13 at 09:32

2 Answers2

2

I don't think IDEA is to blame here. Griffon is exploiting a trick that Groovy brings to the table: using closures as annotation values. However @PropertyListener goes a bit further by allowing closure properties to be used too, but in order to do it converts invalid code (a property name cannot be used as an annotation value) into valid code (changes the annotation value into an empty String).

There is no way IDEA can be aware that the Griffon compiler is using this trick, hence the red squiggles. Regardless of this, don't be alarmed, the Griffon compiler will do the right thing.

Andres Almiray
  • 3,236
  • 18
  • 28
  • So, it's next task for IntelliJ to handle such sort of tricks :) – Askar Apr 15 '13 at 07:10
  • Only if a ticket is raised in their issue tracker and a patch is submitted. Griffon support for IDEA is provided by the Community Edition, which means anyone can read the code and submit a patch. – Andres Almiray Apr 15 '13 at 10:37
  • The ticket (I mentioned above) was created just today by JetBrains. Its subject: Griffon: @PropertyListener annotation – Askar Apr 15 '13 at 12:14
  • Added a bit more of information to IDEA-105357 so that implementors know what's going on. – Andres Almiray Apr 15 '13 at 13:04
  • Thanks a lot for your valuable input on the ticket! – Askar Apr 16 '13 at 01:26
1

Fixed. IntelliJ IDEA 12.1.2 will support it

Max Medvedev
  • 303
  • 2
  • 7