Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
AST
TRANSFORMATIONS:
GROOVY’S BEST
KEPT SECRET
ANDRES ALMIRAY
@AALMIRAY
ABOUT THE SPEAKER
Java developer since the beginning
True believer in Open Source
Groovy committer since 2007
Project lead...
AGENDA
AST, How did we get here?
AST Transformations
Building your own AST
AST,
HOW DID
WE GET
HERE?
AST
TRANSFOR
MATIONS
E	

V	

I	

L	

G	

E	

N	

I	

U	

S
STANDARD GROOVY
DISTRO INCLUDES:
*  @EqualsAndHashCode
*  @ToString
*  @TupleConstructor
*  @Canonical
*  @InheritConstruc...
STANDARD GROOVY
DISTRO INCLUDES:
*  @Bindable
*  @Vetoable
*  @ListenerList
*  @ConditionalInterrupt
*  @ThreadInterrupt
*...
GROOVY ECOSYSTEM
BRINGS:
*  @ByteCode
*  @Scalify
*  GContracts
*  @Invariant
*  @Requires
*  @Ensures
*  Grails
*  @Entit...
GLOBALAST
TRANSFORMATIONS
Groovy – Grab
Grails – GORM API
Griffon – Threading injection
Spock – the whole shebang
BUILDING
YOUR OWN
AST
LOCALAST
TRANSFORMATION
1.  Define an @interface
•  Easy peasy … right?
2.  Define AST implementation
•  huh ……
3.  Profit!
GLOBALAST
TRANSFORMATION
1.  Add AST implementation entry to
•  META-INF/services/
org.codehaus.groovy.transform.ASTTransf...
ADDITIONAL TOOLS
AST browser
AST Builder
DOCS? DON’T MIND IF I DO
https://github.com/melix/ast-workshop
Setup gradle 1.6 (or use gradlew)
Browse docs/gen/workshop....
Thank You!
@aalmiray
andres.almiray@canoo.com
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
AST Transformations: Groovy’s best kept secret by Andres Almiray
Upcoming SlideShare
Loading in …5
×

AST Transformations: Groovy’s best kept secret by Andres Almiray

1,102 views

Published on

Published in: Technology, Education
  • Be the first to comment

AST Transformations: Groovy’s best kept secret by Andres Almiray

  1. 1. AST TRANSFORMATIONS: GROOVY’S BEST KEPT SECRET ANDRES ALMIRAY @AALMIRAY
  2. 2. ABOUT THE SPEAKER Java developer since the beginning True believer in Open Source Groovy committer since 2007 Project lead of the Griffon framework Currently working for
  3. 3. AGENDA AST, How did we get here? AST Transformations Building your own AST
  4. 4. AST, HOW DID WE GET HERE?
  5. 5. AST TRANSFOR MATIONS
  6. 6. E V I L G E N I U S
  7. 7. STANDARD GROOVY DISTRO INCLUDES: *  @EqualsAndHashCode *  @ToString *  @TupleConstructor *  @Canonical *  @InheritConstructors *  @IndexedProperty *  @Lazy *  @PackageScope *  @NotYetImplemented *  @AutoClone *  @AutoExternalize *  @Synchronized *  @Field *  @Grab *  @GrabResolver *  @CompileStatic *  @TypeChecked *  @ASTTest
  8. 8. STANDARD GROOVY DISTRO INCLUDES: *  @Bindable *  @Vetoable *  @ListenerList *  @ConditionalInterrupt *  @ThreadInterrupt *  @TimedInterrupt *  @WithReadLock *  @WithWriteLock *  @Newify *  @Log *  @Slf4j *  @Log4j *  @Commons *  @Singleton *  @Immutable *  @Delegate *  @Category *  @Mixin
  9. 9. GROOVY ECOSYSTEM BRINGS: *  @ByteCode *  @Scalify *  GContracts *  @Invariant *  @Requires *  @Ensures *  Grails *  @Entity *  @TestFor *  Griffon *  @EventPublisher *  @Threading *  @PropertyListener *  @MVCAware *  @MessageSourceAware *  @ResourceResolverAware *  @ResourcesAware *  @ThreadingAware
  10. 10. GLOBALAST TRANSFORMATIONS Groovy – Grab Grails – GORM API Griffon – Threading injection Spock – the whole shebang
  11. 11. BUILDING YOUR OWN AST
  12. 12. LOCALAST TRANSFORMATION 1.  Define an @interface •  Easy peasy … right? 2.  Define AST implementation •  huh …… 3.  Profit!
  13. 13. GLOBALAST TRANSFORMATION 1.  Add AST implementation entry to •  META-INF/services/ org.codehaus.groovy.transform.ASTTransformation 2.  Define AST implementation •  ??? !!! ??? !!! 3.  Profit!
  14. 14. ADDITIONAL TOOLS AST browser AST Builder
  15. 15. DOCS? DON’T MIND IF I DO https://github.com/melix/ast-workshop Setup gradle 1.6 (or use gradlew) Browse docs/gen/workshop.html
  16. 16. Thank You! @aalmiray andres.almiray@canoo.com

×