Your SlideShare is downloading. ×
<ul>A Very Groovy Birthday <li>Hamlet D'Arcy
Canoo Engineering AG
@HamletDRC </li></ul>
A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years
Hamlet D'Arcy
Canoo Engineering AG
@HamletDRC </li></ul>
A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years Groovy – 10 th  Year
Hamlet D'Arcy
Canoo Engineering AG
@HamletDRC </li></ul>
2003 <ul></ul>
2003 <ul></ul>
2003 Closure <ul></ul>
“Refactored CompositeString  to be called ______ :)”
2003 Closure GString <ul></ul>
2003 Range Closure GString <ul></ul>
2003 Range MarkupBuilder Closure GString <ul></ul>
new  groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id:  &quot;child $it &quot; ) } }
new  groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id:  &quot;child $it &quot; ) } } <root> <child id='child...
2004 2003 Range MarkupBuilder Closure GString <ul></ul>
2004 2003 JSR-241 Range MarkupBuilder Closure GString <ul></ul>
2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
def  text =  '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def  vars = [person: 'JUG' , ...
def  text =  '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def  vars = [person: 'JUG' , ...
2005 2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
2006 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
2006 2005 2004 2003 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>...
2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString ...
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
String. class .metaClass.default = { self ->  self ?:  '<unknown>' } '' .default()
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GSt...
2008 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closur...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
@Grab( group= 'org.ccil.cowan.tagsoup' ,  module= 'tagsoup' ,  version= '1.2' ) import  org.ccil.cowan.tagsoup.Parser def ...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder ...
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
def  (x, y) = [ 1 ,  2 ] @Singleton, @Lazy, @Immutable, @Delegate,  ... and more
def  (x, y) = [ 1 ,  2 ] assert  x == 1 assert  y == 2
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBui...
2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range Mark...
2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range Mark...
2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range Mark...
2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range Mark...
2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range...
2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range...
Command Chains stand 7.minutes at busstop ride 10.stops on bus towards Basel
JSON Builder import  groovy.json.* def  json =  new  JsonBuilder() json.person { name  'William Tell' status  'mythologica...
AST Transformations @ToString, @EqualsAndHashCode @TupleConstructor, @Canonical @Log, @Field, @Package, ... and many more
2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range...
2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine ...
2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine ...
2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 2.0 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEng...
void  method(String message) { if  (message !=  null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ...
@groovy.transform.TypeChecked void  method(String message) { if  (message !=  null ) { log.info( &quot;Received input: ${ ...
@groovy.transform.TypeChecked void  method(String message) { if  (message !=  null ) { log.info( &quot;Received input: ${ ...
void  method(Object message) { if  (message  instanceof  String) { log.info( &quot;Received input: &quot;  + message.toUpp...
@groovy.transform.TypeChecked void  method(Object message) { if  (message  instanceof  String) { log.info( &quot;Received ...
def   keys =  [x: 1 ,y: 2 ,z: 3 ] *.key def   values =  [x: '1' ,y: '2' ,z: '3' ] *.value keys*.toUpperCase() values*.toUp...
Dimension d1 = [ 100 ]  Dimension d2 = [ '100' , '200' ]  Dimension d3 =  new   Dimension(   width:  100 ,    height:  100...
@groovy.transform.TypeChecked –  Not a static compiler –  No new syntax  –  No new semantics –  Bytecode not changed –  Ta...
Upcoming SlideShare
Loading in...5
×

10 Years of Groovy

974

Published on

10 Year retrospective of Groovy: the language and the ecosystem

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
974
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "10 Years of Groovy"

  1. 1. <ul>A Very Groovy Birthday <li>Hamlet D'Arcy
  2. 2. Canoo Engineering AG
  3. 3. @HamletDRC </li></ul>
  4. 4. A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years
  5. 5. Hamlet D'Arcy
  6. 6. Canoo Engineering AG
  7. 7. @HamletDRC </li></ul>
  8. 8. A Very Groovy Birthday <ul><li>Geneva JUG – 2 Years Groovy – 10 th Year
  9. 9. Hamlet D'Arcy
  10. 10. Canoo Engineering AG
  11. 11. @HamletDRC </li></ul>
  12. 12. 2003 <ul></ul>
  13. 13. 2003 <ul></ul>
  14. 14. 2003 Closure <ul></ul>
  15. 15. “Refactored CompositeString to be called ______ :)”
  16. 16. 2003 Closure GString <ul></ul>
  17. 17. 2003 Range Closure GString <ul></ul>
  18. 18. 2003 Range MarkupBuilder Closure GString <ul></ul>
  19. 19. new groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id: &quot;child $it &quot; ) } }
  20. 20. new groovy.xml.MarkupBuilder().root() { ( 1 .. 3 ).each { child(id: &quot;child $it &quot; ) } } <root> <child id='child1' /> <child id='child2' /> <child id='child3' /> </root>
  21. 21. 2004 2003 Range MarkupBuilder Closure GString <ul></ul>
  22. 22. 2004 2003 JSR-241 Range MarkupBuilder Closure GString <ul></ul>
  23. 23. 2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  24. 24. def text = '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def vars = [person: 'JUG' , city: 'Geneva' , signed: 'Hamlet' ] def engine = new groovy.text.SimpleTemplateEngine() engine.createTemplate(text).make(vars)
  25. 25. def text = '''Dear $person, So nice to meet you in <% print city %>. Sincerely, $signed''' def vars = [person: 'JUG' , city: 'Geneva' , signed: 'Hamlet' ] def engine = new groovy.text.SimpleTemplateEngine() engine.createTemplate(text).make(vars) Dear JUG, So nice to meet you in Geneva. Sincerely, Hamlet
  26. 26. 2005 2004 2003 JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  27. 27. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  28. 28. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  29. 29. 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  30. 30. 2006 2005 2004 2003 XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>
  31. 31. 2006 2005 2004 2003 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  32. 32. 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  33. 33. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>0.1-0.3
  34. 34. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.1-0.3
  35. 35. String. class .metaClass.default = { self -> self ?: '<unknown>' } '' .default()
  36. 36. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  37. 37. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  38. 38. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  39. 39. 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  40. 40. 2008 2007 2006 2005 2004 2003 Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  41. 41. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0, 1.5 0.4-0.7 0.1-0.3
  42. 42. @Grab( group= 'org.ccil.cowan.tagsoup' , module= 'tagsoup' , version= '1.2' ) import org.ccil.cowan.tagsoup.Parser def parser = new XmlParser(new Parser()) def url = 'http://twitter.com/hamletdrc' def html = parser.parse(url)
  43. 43. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  44. 44. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  45. 45. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  46. 46. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  47. 47. 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  48. 48. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  49. 49. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  50. 50. def (x, y) = [ 1 , 2 ] @Singleton, @Lazy, @Immutable, @Delegate, ... and more
  51. 51. def (x, y) = [ 1 , 2 ] assert x == 1 assert y == 2
  52. 52. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  53. 53. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  54. 54. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  55. 55. 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  56. 56. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  57. 57. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  58. 58. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  59. 59. 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  60. 60. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  61. 61. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  62. 62. Command Chains stand 7.minutes at busstop ride 10.stops on bus towards Basel
  63. 63. JSON Builder import groovy.json.* def json = new JsonBuilder() json.person { name 'William Tell' status 'mythological' }
  64. 64. AST Transformations @ToString, @EqualsAndHashCode @TupleConstructor, @Canonical @Log, @Field, @Package, ... and many more
  65. 65. 2011 2010 2009 2008 2007 2006 2005 2004 2003 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  66. 66. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  67. 67. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  68. 68. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 2.0 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3
  69. 69. void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } }
  70. 70. @groovy.transform.TypeChecked void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } }
  71. 71. @groovy.transform.TypeChecked void method(String message) { if (message != null ) { log.info( &quot;Received input: ${ message.toUppercase() }&quot; ) } } 1 compilation error: [Static type checking] - Cannot find matching method java.lang.String#toUppercase() at line: 4, column: 43
  72. 72. void method(Object message) { if (message instanceof String) { log.info( &quot;Received input: &quot; + message.toUpperCase() ); } }
  73. 73. @groovy.transform.TypeChecked void method(Object message) { if (message instanceof String) { log.info( &quot;Received input: ${ message.toUpperCase() }&quot; ) } }
  74. 74. def keys = [x: 1 ,y: 2 ,z: 3 ] *.key def values = [x: '1' ,y: '2' ,z: '3' ] *.value keys*.toUpperCase() values*.toUpperCase()
  75. 75. Dimension d1 = [ 100 ] Dimension d2 = [ '100' , '200' ] Dimension d3 = new Dimension( width: 100 , height: 100 , depth: 100 )
  76. 76. @groovy.transform.TypeChecked – Not a static compiler – No new syntax – No new semantics – Bytecode not changed – Targeted at Java developers
  77. 77. def v = 1 v = v.toString() println v.toUpperCase()
  78. 78. Flow Sensitive Typing def v = 1 v = v.toString() println v.toUpperCase()
  79. 79. Flow Sensitive Typing def v = 1 v = v.toString() println v.toUpperCase() – Under discussion
  80. 80. int fib(int i) { i < 2 ? 1 : fib(i - 2 ) + fib(i - 1 ) }
  81. 81. @groovy.transform.CompileStatic int fib(int i) { i < 2 ? 1 : fib(i - 2 ) + fib(i - 1 ) }
  82. 82. @groovy.transform.CompileStatic – Is a static compiler – No new syntax – Requires new semantics – Bytecode is changed
  83. 83. @groovy.transform.CompileStatic – Is a static compiler – No new syntax – Requires new semantics – Bytecode is changed – InvokeDynamic?
  84. 84. 2011 2010 2009 2008 2007 2006 2005 2004 2003 2012 2.0 @Grab Gant 0.3 Duration MockFor XmlSlurper JSR-241 SimpleTemplateEngine Range MarkupBuilder Closure GString <ul></ul>1.0 1.0 0.17 1.0 1.8 2.0 1.3 0.9 0.4, 0.5 1.6, 1.7 1.1, 1.2 1.0 1.0, 1.5 0.4-0.7 0.1-0.3

×