Skip to content

Instantly share code, notes, and snippets.

@keima
Created June 22, 2017 12:18
Show Gist options
  • Select an option

  • Save keima/f17694ab2c2cd54db023d2b54b95e345 to your computer and use it in GitHub Desktop.

Select an option

Save keima/f17694ab2c2cd54db023d2b54b95e345 to your computer and use it in GitHub Desktop.
// Package X
class Foo {
interface FooInterface {
void fnFoo();
}
}
public class Bar {
public void prepareFoo(VisibleFooInterface foo) {
foo.fnFoo();
}
public interface VisibleFooInterface extends Foo.FooInterface {
// below code is waste whether or not
// void fnFoo();
}
}
// Package Y (Kotlin)
class BuzKt {
fun main(args : Array<String>) {
// belows are crash `java.lang.IllegalAccessError:
// Illegal class access: 'BuzKt'
// attempting to access 'Foo$FooInterface'`
Bar().prepareFoo(object: VisibleFooInterface { println("Hoge") })
Bar().prepareFoo { println("Fuga") }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment