Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
❤
❤
❤
❤
❤
❤
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Special Danveloper Amendment
1. When Dan get the question right:
a.Dan ________
b.Baruch ________
c.The audience ________
2. When Dan get the question wrong:
a.Dan ________
b.Baruch ________
c.The audience ________
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def comments = ['FRIST!', 'YAS!']
println comments[3]
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def comments = ['FRIST!', 'YAS!']
println comments[3]
def comments = ['FRIST!', 'YAS!']
println comments[3]
Calls default
methods
i is smaller than
size
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def l1 = [1,2,3]
def l2 = []
def l3 = null
println "${l1?.first()}; ${l2?.first()}; ${l3?.first()}"
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def l1 = [1,2,3]
def l2 = []
def l3 = null
println "${l1?.first()}; ${l2?.first()}; ${l3?.first()}"
def l1 = [1,2,3]
def l2 = []
def l3 = null
println "${l1?.first()}; ${l2?.first()}; ${l3?.first()}"
Calls different
default method!
Is empty!
println l2?.getAt(0)
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
String burger = 'burgers'
Long bites = 1
def m = [(burger): [bites]] as Map<String,List<Long>>
println m
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
String burger = 'burgers'
Long bites = 1
def m = [(burger): [bites]] as Map<String,List<Long>>
println m
def m = [(burger): [bites]] as Map<String,List<Long>>
println m
Evaluated as a bit
shift operation
def m = [(burger): [bites]] as Map<String,List<Long> >
def m = [(burger): [bites]] as Map<String,List<Long>>;
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
int burger = 0
int fries = ++burger++
println "Burger: $burger; Fries: $fries"
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
int burger = 0
int fries = ++burger++
println "Burger: $burger; Fries: $fries"
Calls increment
with value
int burger = 0
int fries = ++burger++
Calls increment
with same value
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def thing1 = 0 % 20
def thing2 = 0 % (20 / 1)
println thing1 == thing2
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def thing1 = 0 % 20
def thing2 = 0 % (20 / 1)
println thing1 == thing2
Right side is a
BigDecimal
def thing1 = 0 % 20
def thing2 = 0 % (20 / 1)
println thing1 == thing2
Both sides are
integers
def thing2 = 0 % (20 / 1).intValue()
def thing2 = 0.toBigDecimal().remainder((20 / 1)).intValue()
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def static theAnswerToLifeTheUniverseAndEverything() {
{ 42 }
}
println theAnswerToLifeTheUniverseAndEverything()
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def static theAnswerToLifeTheUniverseAndEverything() {
{ 42 }
}
println theAnswerToLifeTheUniverseAndEverything()
def static theAnswerToLifeTheUniverseAndEverything() {
{ 42 }
}
println theAnswerToLifeTheUniverseAndEverything()
Ambiguous return
statement
def static theAnswerToLifeTheUniverseAndEverything() {
return { 42 }
}
def static theAnswerToLifeTheUniverseAndEverything() {
return { -> 42 }
}
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def pathPattern = $/.*/path/to/resource.*/$
Escape rules are
different for /
def multilinePattern = $/
We can even
have multilines.
/$
println $/.*The Doctor.*/$
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
println $/.*The Doctor.*/$
Confuses the
parser
println $/.*The Doctor.*/$
println ($/.*The Doctor.*/$)
I HAVE
RETURNED!
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
doubleVision = { x ->
println x
}
doubleVision("doubleVision${doubleVision}")
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
doubleVision = { x ->
println x
}
doubleVision("doubleVision${doubleVision}")
doubleVision = { x ->
println x
}
doubleVision("doubleVision${doubleVision}")
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def static hello(n) {
['9': "GR8Conf 2${n}17"]
}
def result = hello 09
println result
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def static hello(n) {
['9': "GR8Conf 2${n}17"]
}
def result = hello 09
println result
def static hello(n) {
['9': "GR8Conf 2${n}17"]
}
def result = hello 09
println result
Is it actually an
octal?
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def tardis = new Tardis() {
static class Tardis {
def travel() { "It's Minneapolis in the year 1799!" }
}
}
println tardis.travel()
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
def tardis = new Tardis() {
static class Tardis {
def travel() { "It's Minneapolis in the year 1799!" }
}
}
println tardis.travel()
Maybe the order of initialization?
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
1. Write readable code
2. Comment your tricks
3. Sometimes it’s only a bug
4. Use static analysis

(IntellijIDEA FTW!)
5. RTfM
6.The Parrot will fix it.
This is the 4th consecutive edition!
(Next time in uniform)

Puzzlers? Gotchas? Fetal-position
inducing behavior?
Write to us at:
• puzzlers@jfrog.com
• @Groovypuzzlers
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
Positive feedback?
• #groovypuzzlers
• @groovypuzzlers
• @jbaruch
• @danveloper
Negative feedback?
/dev/null
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017

More Related Content

PDF
Python for High School Programmers
PDF
TXT
Bouncingballs sh
PDF
QNlocal: Docker, Continuous Integration, WordPress e milioni di visite. Si è ...
TXT
PDF
A Taste of Python - Devdays Toronto 2009
PDF
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
PDF
PHP 101
Python for High School Programmers
Bouncingballs sh
QNlocal: Docker, Continuous Integration, WordPress e milioni di visite. Si è ...
A Taste of Python - Devdays Toronto 2009
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
PHP 101

What's hot (20)

PDF
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
PDF
Chapter 2: R tutorial Handbook for Data Science and Machine Learning Practiti...
PDF
Async: ways to store state
PPTX
Groovy puzzlers jug-moscow-part 2
PDF
Pre-Bootcamp introduction to Elixir
PDF
Python Menu
PDF
JavaOne 2017 | JShell: The Ultimate Missing Tool
PPTX
Super Advanced Python –act1
PDF
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
PDF
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
PDF
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
PPT
Functional Pe(a)rls version 2
ODP
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
PDF
Benchmarking Perl Lightning Talk (NPW 2007)
PDF
Palestra sobre Collections com Python
PDF
PDF
RxSwift 시작하기
PPT
An Elephant of a Different Colour: Hack
PDF
I  Swift
PDF
The Error of Our Ways
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
Chapter 2: R tutorial Handbook for Data Science and Machine Learning Practiti...
Async: ways to store state
Groovy puzzlers jug-moscow-part 2
Pre-Bootcamp introduction to Elixir
Python Menu
JavaOne 2017 | JShell: The Ultimate Missing Tool
Super Advanced Python –act1
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Functional Pe(a)rls version 2
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
Benchmarking Perl Lightning Talk (NPW 2007)
Palestra sobre Collections com Python
RxSwift 시작하기
An Elephant of a Different Colour: Hack
I  Swift
The Error of Our Ways
Ad

Similar to Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017 (20)

PDF
Functional Programming with Groovy
PDF
Python Puzzlers - 2016 Edition
KEY
循環参照のはなし
PDF
Python Functions (PyAtl Beginners Night)
PDF
Perl 6 in Context
PPTX
The groovy puzzlers (as Presented at JavaOne 2014)
KEY
Exhibition of Atrocity
PDF
Static Optimization of PHP bytecode (PHPSC 2017)
PDF
CoffeeScript
PDF
A Few of My Favorite (Python) Things
PDF
Feel of Kotlin (Berlin JUG 16 Apr 2015)
PDF
Introduction to Recursion (Python)
KEY
Document Classification In PHP
PDF
All I Needed for Functional Programming I Learned in High School Algebra
PDF
여자개발자모임터 6주년 개발 세미나 - Scala Language
PDF
The groovy puzzlers (as Presented at Gr8Conf US 2014)
PDF
Frege - consequently functional programming for the JVM
PPTX
Csci101 lect04 advanced_selection
PDF
lec4_annotated.pdf ml csci 567 vatsal sharan
PDF
Jamieson_Jain2018
Functional Programming with Groovy
Python Puzzlers - 2016 Edition
循環参照のはなし
Python Functions (PyAtl Beginners Night)
Perl 6 in Context
The groovy puzzlers (as Presented at JavaOne 2014)
Exhibition of Atrocity
Static Optimization of PHP bytecode (PHPSC 2017)
CoffeeScript
A Few of My Favorite (Python) Things
Feel of Kotlin (Berlin JUG 16 Apr 2015)
Introduction to Recursion (Python)
Document Classification In PHP
All I Needed for Functional Programming I Learned in High School Algebra
여자개발자모임터 6주년 개발 세미나 - Scala Language
The groovy puzzlers (as Presented at Gr8Conf US 2014)
Frege - consequently functional programming for the JVM
Csci101 lect04 advanced_selection
lec4_annotated.pdf ml csci 567 vatsal sharan
Jamieson_Jain2018
Ad

More from Baruch Sadogursky (20)

PDF
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
PDF
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
PDF
Data driven devops as presented at QCon London 2018
PDF
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
PDF
Java Puzzlers NG S03 a DevNexus 2018
PDF
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
PDF
Data driven devops as presented at Codemash 2018
PDF
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
PPTX
Best Practices for Managing Docker Versions as presented at JavaOne 2017
PDF
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
PPTX
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
PDF
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
PDF
Let’s Wing It: A Study in DevRel Strategy
PDF
Log Driven First Class Customer Support at Scale
PPTX
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
Data driven devops as presented at QCon London 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
Java Puzzlers NG S03 a DevNexus 2018
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
Data driven devops as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
Best Practices for Managing Docker Versions as presented at JavaOne 2017
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
Let’s Wing It: A Study in DevRel Strategy
Log Driven First Class Customer Support at Scale
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...

Recently uploaded (20)

PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
NewMind AI Weekly Chronicles – August ’25 Week III
WOOl fibre morphology and structure.pdf for textiles
sustainability-14-14877-v2.pddhzftheheeeee
A comparative study of natural language inference in Swahili using monolingua...
observCloud-Native Containerability and monitoring.pptx
Getting Started with Data Integration: FME Form 101
Group 1 Presentation -Planning and Decision Making .pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
CloudStack 4.21: First Look Webinar slides
Enhancing emotion recognition model for a student engagement use case through...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
The various Industrial Revolutions .pptx
DP Operators-handbook-extract for the Mautical Institute
Chapter 5: Probability Theory and Statistics
Final SEM Unit 1 for mit wpu at pune .pptx
O2C Customer Invoices to Receipt V15A.pptx
A novel scalable deep ensemble learning framework for big data classification...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf

Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017