GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1554

Missing DSLD support for AST transformations

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.1.Release
    • Fix Version/s: 2.7.2.Release
    • Component/s: DSL Support
    • Labels:
      None
    • Number of attachments :
      6

      Description

      There are a handful of AST transformations for which no DSLD support is ready. During a recent Hackergarten we put together DSLDs for the following annotations

      • @Log; @Log4j, @Commons, @Slf4j
      • @Bindable, @Vetoable
      • @ListenerList
      • @AutoExternalize
      1. autoExternalize.dsld
        0.2 kB
        Andres Almiray
      2. bindable.dsld
        5 kB
        Andres Almiray
      3. listenerList.dsld
        2 kB
        Andres Almiray
      4. logging.dsld
        0.9 kB
        Andres Almiray
      5. vetoable.dsld
        5 kB
        Andres Almiray

        Issue Links

          Activity

          Hide
          Andres Almiray added a comment -

          Attached DSLDs, separated by category

          Show
          Andres Almiray added a comment - Attached DSLDs, separated by category
          Hide
          Andrew Eisenberg added a comment -

          All of the dslds work as expected. I had to make a few changes to ensure corner cases don't throw exceptions. A few questions and comments:

          1. Missing license statements. I added them
          2. In vetoable and bindable, you add the methods in a separate closure. Is there a reason for this separation? I'd prefer to keep things simpler and not use the closure.
          3. Are there any AST transforms in this list not compatible with groovy 1.8?
          4. I prefer to use class references instead of strings where possible. I am making those changes.
          Show
          Andrew Eisenberg added a comment - All of the dslds work as expected. I had to make a few changes to ensure corner cases don't throw exceptions. A few questions and comments: Missing license statements. I added them In vetoable and bindable, you add the methods in a separate closure. Is there a reason for this separation? I'd prefer to keep things simpler and not use the closure. Are there any AST transforms in this list not compatible with groovy 1.8? I prefer to use class references instead of strings where possible. I am making those changes.
          Hide
          Andres Almiray added a comment -

          1. thanks
          2. That's because there are 2 pointcuts and we didn't find the syntax for joining them. Either @Bindable/@Vetoable annotates the class or any field with @Bindable/@Vetoable.
          3. All of them are specific to Groovy 1.8
          4. OK, however keep String literals in the logging xforms as only @Log will work for sure without extra deps in the classpath.

          Show
          Andres Almiray added a comment - 1. thanks 2. That's because there are 2 pointcuts and we didn't find the syntax for joining them. Either @Bindable/@Vetoable annotates the class or any field with @Bindable/@Vetoable. 3. All of them are specific to Groovy 1.8 4. OK, however keep String literals in the logging xforms as only @Log will work for sure without extra deps in the classpath.
          Hide
          Andrew Eisenberg added a comment -

          I only see one pointcut in these dsld files (well, one complex pointcut connected by |).

          I simplified the pointcut you have to this:

          ontribute(currentType(annotatedBy("groovy.beans.Bindable") |
          	       fields(annotatedBy("groovy.beans.Bindable"))))
          

          So, now currentType is only used once. I also made the change to bring the method inside of the contribution block. This still works for me. If you are OK with this, I am just about ready to merge this.

          And thanks for pointing out #4. I figured it out the hard way after I tried using class references there.

          Show
          Andrew Eisenberg added a comment - I only see one pointcut in these dsld files (well, one complex pointcut connected by |). I simplified the pointcut you have to this: ontribute(currentType(annotatedBy( "groovy.beans.Bindable" ) | fields(annotatedBy( "groovy.beans.Bindable" )))) So, now currentType is only used once. I also made the change to bring the method inside of the contribution block. This still works for me. If you are OK with this, I am just about ready to merge this. And thanks for pointing out #4. I figured it out the hard way after I tried using class references there.
          Hide
          Andres Almiray added a comment -

          Oh I see. I think we had them as separate pointcuts then decided to merge them but left the method definitions outside. It makes more sense to have everything in one place as you suggest.

          Show
          Andres Almiray added a comment - Oh I see. I think we had them as separate pointcuts then decided to merge them but left the method definitions outside. It makes more sense to have everything in one place as you suggest.
          Hide
          Andrew Eisenberg added a comment -

          Makes sense now. I pushed the contribution. Here is the final commit:

          https://github.com/groovy/groovy-eclipse/commit/f5d3f274a72d7b49486f0dc8176356632ff8c36e

          I haven't written unit tests for these yet (naughty, naughty), but all is working for me right now.

          Show
          Andrew Eisenberg added a comment - Makes sense now. I pushed the contribution. Here is the final commit: https://github.com/groovy/groovy-eclipse/commit/f5d3f274a72d7b49486f0dc8176356632ff8c36e I haven't written unit tests for these yet (naughty, naughty), but all is working for me right now.
          Hide
          Ivan Arrizabalaga Getino added a comment -

          Hi,
          not really sure if it's the same issue or not but it looks related.

          I've tried to use @ListenerList in a groovy 1.8 project but greclipse 2.7.2 fails to compile it showing:

          Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener
          Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener
          Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener
          Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener
          ..
          //9 times and growing (looks something internal not refreshing a list of methods)

          This happens under the following enviroment:

          IDE: Groovy/Grails Tool Suite 3.1.0 (based Eclipse 3.8 Juno)
          IDE Groovy compiler: 1.8.6.xx-RELEASE-20121219-0800-e42

          If I change the compiler to 2.0.6.xx-RELEASE-20121219-0800-e42 everything works perfectly.

          Hope it helps.
          Ivan

          Pd: Attach a mini project to show it.

          Show
          Ivan Arrizabalaga Getino added a comment - Hi, not really sure if it's the same issue or not but it looks related. I've tried to use @ListenerList in a groovy 1.8 project but greclipse 2.7.2 fails to compile it showing: Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener Groovy:Conflict using @groovy.beans.ListenerList. Class nortia.GroovyListener already has method addTalkListener .. //9 times and growing (looks something internal not refreshing a list of methods) This happens under the following enviroment: IDE: Groovy/Grails Tool Suite 3.1.0 (based Eclipse 3.8 Juno) IDE Groovy compiler: 1.8.6.xx-RELEASE-20121219-0800-e42 If I change the compiler to 2.0.6.xx-RELEASE-20121219-0800-e42 everything works perfectly. Hope it helps. Ivan Pd: Attach a mini project to show it.
          Hide
          Ivan Arrizabalaga Getino added a comment -

          Minimum project with a @ListenerList annotation.

          Show
          Ivan Arrizabalaga Getino added a comment - Minimum project with a @ListenerList annotation.
          Hide
          Andrew Eisenberg added a comment -

          Thanks for the bug report, but this is a different issue. I'll raise a new one for you. Currently on vacation, but will look at it when I get back.

          Show
          Andrew Eisenberg added a comment - Thanks for the bug report, but this is a different issue. I'll raise a new one for you. Currently on vacation, but will look at it when I get back.

            People

            • Assignee:
              Andrew Eisenberg
              Reporter:
              Andres Almiray
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: