Skip to content

Instantly share code, notes, and snippets.

@wololock
Created November 15, 2018 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wololock/d7317b7cdb9eedc1a2df81c34dc92f69 to your computer and use it in GitHub Desktop.
Save wololock/d7317b7cdb9eedc1a2df81c34dc92f69 to your computer and use it in GitHub Desktop.
import groovy.transform.CompileStatic
class WaitTest {
void testFail() {
Closure c = {
shout()
println toString()
println delegate.toString()
println this.toString()
wait(100)
shout()
}
c.delegate = new Aha()
c.resolveStrategy = Closure.DELEGATE_ONLY
synchronized (this) {
c.call()
}
}
}
@CompileStatic
class Aha {
void shout() {
println "AHA!"
}
String toString() {
"HAHAHAHAHA!"
}
}
new WaitTest().testFail()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment