Effective visibility: java package-private is now considered as equivalent to Kotlin internal #KT-9755 Fixed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// FILE: test/My.java
|
||||
|
||||
package test;
|
||||
|
||||
class Internal {}
|
||||
|
||||
public class My {
|
||||
static public Internal foo() { return new Internal(); }
|
||||
}
|
||||
|
||||
// FILE: test/His.kt
|
||||
|
||||
package test
|
||||
|
||||
class His {
|
||||
// Ok: private vs package-private
|
||||
private fun private() = My.foo()
|
||||
// Ok: internal vs package-private in same package
|
||||
internal fun internal() = My.foo()
|
||||
// Error: protected vs package-private
|
||||
protected fun <!EXPOSED_FUNCTION_RETURN_TYPE!>protected<!>() = My.foo()
|
||||
// Error: public vs package-private
|
||||
fun <!EXPOSED_FUNCTION_RETURN_TYPE!>public<!>() = My.foo()
|
||||
}
|
||||
|
||||
// FILE: other/Your.kt
|
||||
|
||||
package other
|
||||
|
||||
import test.My
|
||||
|
||||
class Your {
|
||||
// Ok but dangerous: internal vs package-private in different package
|
||||
internal fun bar() = My.foo()
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package
|
||||
|
||||
package other {
|
||||
|
||||
public final class Your {
|
||||
public constructor Your()
|
||||
internal final fun bar(): test.Internal!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package test {
|
||||
|
||||
public final class His {
|
||||
public constructor His()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun internal(): test.Internal!
|
||||
private final fun private(): test.Internal!
|
||||
protected final fun protected(): test.Internal!
|
||||
public final fun public(): test.Internal!
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class My {
|
||||
public constructor My()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public open fun foo(): test.Internal!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user