Default visibility is 'internal', so your example should work correctly. But visibility check is in progress now, so it doesn't tested properly yet. Mind to file an issue about this to http://youtrack.jetbrains.com/issues/KT? Thanks
There is no visibility for anonymous functions. Only members of packages and classes have visibility, and anonymous function cannot be a member (it's not by chance called 'anonymous':) ).
I mean underlying implementation generated by compiler. I guess compiler generates private method for this anonimous function (only guess) or somthing like that. So I mean visibility checked by JVM, not visibility in terms of Kotlin.
You are right. It was haste to make guesses :) I can see the generated classes for my example. I can see getMethod() of AImpl isn't public and "anonimous" function is generated as separate class...
% javap A
Compiled from "cg.Test.kt"
public interface A extends jet.JetObject{
public abstract jet.Function0 getMethod();
public abstract java.lang.Integer getTest();
}
% javap AImpl
Compiled from “cg.Test.kt”
public final class AImpl extends java.lang.Object implements jet.JetObject,A{
final jet.Function0 method;
final java.lang.Integer test; jet.Function0 getMethod();
java.lang.Integer getTest();
public AImpl();
}
% javap AImpl$method$1
Compiled from “cg.Test.kt”
public class AImpl$method$1 extends jet.Function0{
public java.lang.Object invoke();
public final void invoke();
public AImpl$method$1();
public static AImpl$method$1 $getInstance();
}