Groovy AST Demystified

7,018 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,018
On SlideShare
0
From Embeds
0
Number of Embeds
4,992
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Groovy AST Demystified

  1. 1. GROOVYASTCÉDRIC CHAMPEAUANDRES ALMIRAY
  2. 2. GET THE CODEhttps://github.com/melix/ast-workshopSetup gradle 1.6 (or use gradlew)Browse docs/gen/workshop.html
  3. 3. AGENDAAST, How did we get here?AST TransformationsBuilding your own ASTExcercises
  4. 4. AST,HOW DIDWE GETHERE?
  5. 5. ASTTRANSFORMATIONS
  6. 6. E V I L G E N I U S
  7. 7. STANDARD GROOVYDISTRO INCLUDES:*  @EqualsAndHashCode*  @ToString*  @TupleConstructor*  @Canonical*  @InheritConstructors*  @IndexedProperty*  @Lazy*  @PackageScope*  @NotYetImplemented*  @AutoClone*  @AutoExternalize*  @Synchronized*  @Field*  @Grab*  @GrabResolver*  @CompileStatic*  @TypeChecked*  @ASTTest
  8. 8. STANDARD GROOVYDISTRO INCLUDES:*  @Bindable*  @Vetoable*  @ListenerList*  @ConditionalInterrupt*  @ThreadInterrupt*  @TimedInterrupt*  @WithReadLock*  @WithWriteLock*  @Newify*  @Log*  @Slf4j*  @Log4j*  @Commons*  @Singleton*  @Immutable*  @Delegate*  @Category*  @Mixin
  9. 9. GROOVY ECOSYSTEMBRINGS:*  @ByteCode*  @Scalify*  GContracts*  @Invariant*  @Requires*  @Ensures*  Grails*  @Entity*  @TestFor*  Griffon*  @EventPublisher*  @Threading*  @PropertyListener*  @MVCAware*  @MessageSourceAware*  @ResourceResolverAware*  @ResourcesAware*  @ThreadingAware
  10. 10. GLOBALASTTRANSFORMATIONSGroovy – GrabGrails – GORM APIGriffon – Threading injectionSpock – the whole shebang
  11. 11. BUILDINGYOUR OWNAST
  12. 12. LOCALASTTRANSFORMATION1.  Define an @interface•  Easy peasy … right?2.  Define AST implementation•  huh ……3.  Profit!
  13. 13. GLOBALASTTRANSFORMATION1.  Add AST implementation entry to•  META-INF/services/org.codehaus.groovy.transform.ASTTransformation2.  Define AST implementation•  ??? !!! ??? !!!3.  Profit!
  14. 14. ADDITIONAL TOOLSAST browserAST Builder
  15. 15. Thank You!@cedricchampeau@aalmiray

×