ROCKET
PROPELLED
JAVA
ANDRES ALMIRAY
CANOO ENGINEERING A.G.
@AALMIRAY
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
PROJECT LOMBOK
 Where, Who, How?               Why?
 ■  http://projectlombok.org/   ■  Get rid of boiler plate code
 ■  Reinier Zwitserloot         ■  Compiler does the heavy
    @surial
                                   lifting
 ■  Roel Spilker
    @rspilker                   ■  Developers just have to
                                   write the essentials

 ■  Relies on JDK6’s
    Annotation Processor
 ■  Modifies Bytecode at
    compile time



                                                                  3
HOW DOES IT LOOK?




                    4
ANNOTATIONS
 ■  @Getter / @Setter        ■    @Cleanup
 ■  @ToString                ■    @Synchronized
 ■  @EqualsAndHashCode       ■    @SneakyThrows
                             ■    @Log
 ■  @NoArgsConstructor
                             ■    @Delegate
 ■  @AllArgsConstructor
 ■  @Data
 ■  @RequiredArgsConstruct
    or



                                                  5
LOMBOK-PG
 Where, Who, How              Why?
 ■  https://github.com/       ■  Extends Lombok with
    peichhorn/lombok-pg/         additional annotations such
 ■  Philipp Eichhorn             as:
 ■  peichhorn @ github            ■  @Singleton
                                  ■  @FluentSetter
 ■  Delivers its own common       ■  @Builder
    AST API                       ■  and more!
 ■  Easier to write cross
    compiler AST


                                                               6
GROOVY AST TRANSFORMATIONS
 Where, Who, How                Why?
 ■  https://                    ■  Groovy plays nicely with
    groovy.codehaus.org            Java
 ■  The Groovy Team             ■  Compile time
                                   metaprogramming
                                   executes faster than
 ■  Compile time                   runtime
    metaprogramming             ■  Changes visible to other
 ■  Changes registered in the      JVM languages
    bytecode



                                                              7
HOW DOES IT LOOK?
The @Immutable AST transformation makes writing
immutable classes trivial
SOME ANNOTATIONS
 ■  @Bindable / @Vetoable   ■    @Delegate
 ■  @Grab                   ■    @Log
 ■  @Immutable              ■    @Synchronized
                            ■    @AutoClone
 ■  @Singleton
                            ■    @AutoExternalize
 ■  @ToString
 ■  @EqualsAndHashCode      ■  @TypeChecked
 ■  @TupleConstructor       ■  @CompileStatic
 ■  @Canonical
                            ■  Plus many more!


                                                    9
THANK
YOU!
@AALMIRAY
HTTP://PEOPLE.CANOO.COM/SHARE/

Jfokus - Rocket Propelled Java

  • 1.
  • 2.
    ABOUT THE SPEAKER Javadeveloper since the beginning True believer in open source Groovy committer since 2007 Project lead of the Griffon framework Currently working for
  • 3.
    PROJECT LOMBOK Where,Who, How? Why? ■  http://projectlombok.org/ ■  Get rid of boiler plate code ■  Reinier Zwitserloot ■  Compiler does the heavy @surial lifting ■  Roel Spilker @rspilker ■  Developers just have to write the essentials ■  Relies on JDK6’s Annotation Processor ■  Modifies Bytecode at compile time 3
  • 4.
    HOW DOES ITLOOK? 4
  • 5.
    ANNOTATIONS ■  @Getter/ @Setter ■  @Cleanup ■  @ToString ■  @Synchronized ■  @EqualsAndHashCode ■  @SneakyThrows ■  @Log ■  @NoArgsConstructor ■  @Delegate ■  @AllArgsConstructor ■  @Data ■  @RequiredArgsConstruct or 5
  • 6.
    LOMBOK-PG Where, Who,How Why? ■  https://github.com/ ■  Extends Lombok with peichhorn/lombok-pg/ additional annotations such ■  Philipp Eichhorn as: ■  peichhorn @ github ■  @Singleton ■  @FluentSetter ■  Delivers its own common ■  @Builder AST API ■  and more! ■  Easier to write cross compiler AST 6
  • 7.
    GROOVY AST TRANSFORMATIONS Where, Who, How Why? ■  https:// ■  Groovy plays nicely with groovy.codehaus.org Java ■  The Groovy Team ■  Compile time metaprogramming executes faster than ■  Compile time runtime metaprogramming ■  Changes visible to other ■  Changes registered in the JVM languages bytecode 7
  • 8.
    HOW DOES ITLOOK? The @Immutable AST transformation makes writing immutable classes trivial
  • 9.
    SOME ANNOTATIONS ■ @Bindable / @Vetoable ■  @Delegate ■  @Grab ■  @Log ■  @Immutable ■  @Synchronized ■  @AutoClone ■  @Singleton ■  @AutoExternalize ■  @ToString ■  @EqualsAndHashCode ■  @TypeChecked ■  @TupleConstructor ■  @CompileStatic ■  @Canonical ■  Plus many more! 9
  • 10.