Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sample of use
class Hoge {
static String hoge(String delegate) {
return "HOGE: $delegate"
static String foo(String delegate, String param) {
return "FOO: $delegate ($param)"
static String bar(Class<String> string) {
return "BAR"
static String baz(Class<String> string) {
if (!string?.isAssignableFrom(String)) {
throw new ClassCastException("String only")
return "BAZ"
use(Hoge) {
println "A"
println "A".hoge()
println "A".foo()
println "A".foo("BAR")
println // 誤爆
println String.baz()
println Integer.baz() // ClassCastException: String only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.