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.

Groovy AST Demystified

7,425 views

Published on

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

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

×