J2K: adapted for default visibility modifier 'public'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import java.io.File
|
||||
|
||||
fun foo(file: File): List<String> {
|
||||
internal fun foo(file: File): List<String> {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import java.io.File
|
||||
|
||||
class C {
|
||||
internal class C {
|
||||
private fun memberFun(file: File) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
JvmStatic public fun main(args: Array<String>) {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,4 +2,4 @@ package to
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(public val value: KClass<Any>)
|
||||
annotation internal class Ann(val value: KClass<Any>)
|
||||
@@ -1,6 +1,6 @@
|
||||
package to
|
||||
|
||||
public class JavaClass : Runnable {
|
||||
class JavaClass : Runnable {
|
||||
override fun run() {
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package to
|
||||
|
||||
import javaPack.I
|
||||
|
||||
public class C : I {
|
||||
class C : I {
|
||||
override fun foo(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun foo(p: Dependency): Double {
|
||||
internal fun foo(p: Dependency): Double {
|
||||
return p.getInt().toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package to
|
||||
|
||||
Volatile var field = 1
|
||||
Volatile internal var field = 1
|
||||
@@ -1,7 +1,7 @@
|
||||
package to
|
||||
|
||||
public object JavaClass {
|
||||
JvmStatic public fun main(args: Array<String>) {
|
||||
object JavaClass {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
println("Hello, world!")
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
class A {
|
||||
|
||||
|
||||
fun foo() {
|
||||
internal fun foo() {
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
internal fun bar() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package to
|
||||
|
||||
fun foo(p: Int)
|
||||
internal fun foo(p: Int)
|
||||
@@ -1,5 +1,5 @@
|
||||
package to
|
||||
|
||||
public fun foo(): String {
|
||||
fun foo(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package to
|
||||
|
||||
SomeAnnotation
|
||||
public fun foo(): String {
|
||||
fun foo(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class A {
|
||||
return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog"
|
||||
}
|
||||
|
||||
public fun getSelected(): ArrayList<UsageInfo> {
|
||||
fun getSelected(): ArrayList<UsageInfo> {
|
||||
val result = ArrayList<UsageInfo>()
|
||||
for (i in 0..myChecked.length - 1) {
|
||||
if (myChecked[i]) {
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true"}
|
||||
var x = 2 * 3
|
||||
internal var x = 2 * 3
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
inner class X
|
||||
internal inner class X
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
class Y
|
||||
internal class Y
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
fun foo(n: Int): Boolean {
|
||||
internal fun foo(n: Int): Boolean {
|
||||
return n > 0
|
||||
}
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
abstract fun bar(s: String): Int
|
||||
internal abstract fun bar(s: String): Int
|
||||
|
||||
companion object {
|
||||
// INFO: {"checked": "true"}
|
||||
var X = "1" + "2"
|
||||
internal var X = "1" + "2"
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
JvmStatic fun foo2(n: Int): String {
|
||||
JvmStatic internal fun foo2(n: Int): String {
|
||||
return "_" + n + "_"
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,25 +1,25 @@
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
var x = 2 * 3
|
||||
internal var x = 2 * 3
|
||||
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
inner class X
|
||||
internal inner class X
|
||||
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
class Y
|
||||
internal class Y
|
||||
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
abstract fun foo(n: Int): Boolean
|
||||
internal abstract fun foo(n: Int): Boolean
|
||||
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
abstract fun bar(s: String): Int
|
||||
internal abstract fun bar(s: String): Int
|
||||
|
||||
companion object {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
var X = "1" + "2"
|
||||
internal var X = "1" + "2"
|
||||
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
JvmStatic fun foo2(n: Int): String {
|
||||
JvmStatic internal fun foo2(n: Int): String {
|
||||
return "_" + n + "_"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ interface Z<T>
|
||||
|
||||
open class A<T : I, U : I, V> {
|
||||
// INFO: {"checked": "true"}
|
||||
var foo1: T
|
||||
internal var foo1: T
|
||||
// INFO: {"checked": "true"}
|
||||
var foo2: Z<T>
|
||||
internal var foo2: Z<T>
|
||||
// INFO: {"checked": "true"}
|
||||
var foo3: Any
|
||||
internal var foo3: Any
|
||||
// INFO: {"checked": "true"}
|
||||
var foo4: Z<Any>
|
||||
internal var foo4: Z<Any>
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
inner class Foo<S> : A<T, I, Z<Any>>(), Z<I>
|
||||
internal inner class Foo<S> : A<T, I, Z<Any>>(), Z<I>
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
fun <S : T> foo(x1: T, x2: Z<T>, y1: Any, y2: Z<Any>, w1: I, w2: Z<I>, s1: S, s2: Z<S>) {
|
||||
internal fun <S : T> foo(x1: T, x2: Z<T>, y1: Any, y2: Z<Any>, w1: I, w2: Z<I>, s1: S, s2: Z<S>) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
interface A {
|
||||
// INFO: {"checked": "true"}
|
||||
class Y
|
||||
internal class Y
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
fun foo(n: Int): Boolean {
|
||||
internal fun foo(n: Int): Boolean {
|
||||
return n > 0
|
||||
}
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
fun bar(s: String): Int
|
||||
internal fun bar(s: String): Int
|
||||
|
||||
companion object {
|
||||
// INFO: {"checked": "true"}
|
||||
var X = "1" + "2"
|
||||
internal var X = "1" + "2"
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
JvmStatic fun foo2(n: Int): String {
|
||||
JvmStatic internal fun foo2(n: Int): String {
|
||||
return "_" + n + "_"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ class T {
|
||||
class U {
|
||||
abstract class A {
|
||||
// INFO: {"checked": "true"}
|
||||
var x = 2 * 3
|
||||
internal var x = 2 * 3
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
inner class X
|
||||
internal inner class X
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
class Y
|
||||
internal class Y
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
fun foo(n: Int): Boolean {
|
||||
internal fun foo(n: Int): Boolean {
|
||||
return n > 0
|
||||
}
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
abstract fun bar(s: String): Int
|
||||
internal abstract fun bar(s: String): Int
|
||||
|
||||
companion object {
|
||||
// INFO: {"checked": "true"}
|
||||
var X = "1" + "2"
|
||||
internal var X = "1" + "2"
|
||||
|
||||
// INFO: {"checked": "true"}
|
||||
JvmStatic fun foo2(n: Int): String {
|
||||
JvmStatic internal fun foo2(n: Int): String {
|
||||
return "_" + n + "_"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +572,8 @@ class Converter private constructor(
|
||||
PsiModifier.ABSTRACT to Modifier.ABSTRACT,
|
||||
PsiModifier.PUBLIC to Modifier.PUBLIC,
|
||||
PsiModifier.PROTECTED to Modifier.PROTECTED,
|
||||
PsiModifier.PRIVATE to Modifier.PRIVATE
|
||||
PsiModifier.PRIVATE to Modifier.PRIVATE,
|
||||
PsiModifier.PACKAGE_LOCAL to Modifier.INTERNAL
|
||||
)
|
||||
|
||||
private fun convertThrows(method: PsiMethod): Annotations {
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.j2k.ast
|
||||
|
||||
import org.jetbrains.kotlin.j2k.*
|
||||
import java.util.HashSet
|
||||
import org.jetbrains.kotlin.j2k.CodeBuilder
|
||||
|
||||
enum class Modifier(val name: String) {
|
||||
PUBLIC("public"),
|
||||
PROTECTED("protected"),
|
||||
PRIVATE("private"),
|
||||
INTERNAL("internal"),
|
||||
ABSTRACT("abstract"),
|
||||
OPEN("open"),
|
||||
OVERRIDE("override"),
|
||||
@@ -31,13 +31,18 @@ enum class Modifier(val name: String) {
|
||||
public fun toKotlin(): String = name
|
||||
}
|
||||
|
||||
val ACCESS_MODIFIERS = setOf(Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE)
|
||||
val ACCESS_MODIFIERS = setOf(Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE, Modifier.INTERNAL)
|
||||
|
||||
class Modifiers(modifiers: Collection<Modifier>) : Element() {
|
||||
val modifiers = modifiers.toSet()
|
||||
|
||||
override fun generateCode(builder: CodeBuilder) {
|
||||
builder.append(modifiers.sortBy { it.ordinal() }.map { it.toKotlin() }.joinToString(" "))
|
||||
val text = modifiers
|
||||
.sortedBy { it.ordinal() }
|
||||
.filter { it != Modifier.PUBLIC }
|
||||
.map { it.toKotlin() }
|
||||
.joinToString(" ")
|
||||
builder.append(text)
|
||||
}
|
||||
|
||||
override val isEmpty: Boolean
|
||||
@@ -55,7 +60,7 @@ class Modifiers(modifiers: Collection<Modifier>) : Element() {
|
||||
val isPublic: Boolean get() = contains(Modifier.PUBLIC)
|
||||
val isPrivate: Boolean get() = contains(Modifier.PRIVATE)
|
||||
val isProtected: Boolean get() = contains(Modifier.PROTECTED)
|
||||
val isInternal: Boolean get() = accessModifier() == null
|
||||
val isInternal: Boolean get() = contains(Modifier.INTERNAL)
|
||||
|
||||
fun accessModifier(): Modifier? = modifiers.firstOrNull { it in ACCESS_MODIFIERS }
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
annotation class Anon(public val stringArray: Array<String>, public val intArray: IntArray, // string
|
||||
public val string: String)
|
||||
annotation internal class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
|
||||
val string: String)
|
||||
|
||||
Anon(string = "a", stringArray = arrayOf("a", "b"), intArray = intArrayOf(1, 2))
|
||||
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
|
||||
annotation class I
|
||||
annotation internal class I
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
annotation class J
|
||||
annotation internal class J
|
||||
|
||||
@Target
|
||||
annotation class K
|
||||
annotation internal class K
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
annotation class Anon(public val s: String = "a", public val stringArray: Array<String> = arrayOf("a", "b"), public val intArray: IntArray)
|
||||
annotation internal class Anon(val s: String = "a", val stringArray: Array<String> = arrayOf("a", "b"), val intArray: IntArray)
|
||||
|
||||
Anon(intArray = intArrayOf(1, 2))
|
||||
class A
|
||||
internal class A
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
// ERROR: Body is not allowed for annotation class
|
||||
// ERROR: Modifier 'companion' is not applicable inside 'annotation class'
|
||||
annotation class Anon(public val value: String) {
|
||||
annotation internal class Anon(val value: String) {
|
||||
|
||||
public enum class E {
|
||||
enum class E {
|
||||
A, B
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
public val field: E = E.A
|
||||
val field: E = E.A
|
||||
}
|
||||
}
|
||||
|
||||
Anon("a")
|
||||
interface I {
|
||||
internal interface I {
|
||||
companion object {
|
||||
public val e: Anon.E = Anon.field
|
||||
val e: Anon.E = Anon.field
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
annotation class Anon(public vararg val value: String, public val x: Int = 1)
|
||||
annotation internal class Anon(vararg val value: String, val x: Int = 1)
|
||||
|
||||
Anon("a", "b")
|
||||
interface I1
|
||||
internal interface I1
|
||||
|
||||
Anon("c", "d", x = 1)
|
||||
interface I2
|
||||
internal interface I2
|
||||
|
||||
Anon("c", "d", x = 1)
|
||||
interface I3
|
||||
internal interface I3
|
||||
|
||||
Anon(value = *arrayOf("c", "d"))
|
||||
interface I4
|
||||
internal interface I4
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// ERROR: This annotation is not applicable to target 'local variable'
|
||||
// ERROR: This annotation is not applicable to target 'value parameter'
|
||||
// ERROR: This annotation is not applicable to target 'value parameter'
|
||||
import javaApi.*
|
||||
|
||||
Anon1(value = *arrayOf("a"), stringArray = arrayOf("b"), intArray = intArrayOf(1, 2), string = "x")
|
||||
@@ -8,22 +11,22 @@ Anon5(1)
|
||||
Anon6("x", "y")
|
||||
Anon7(String::class, StringBuilder::class)
|
||||
Anon8(classes = arrayOf(String::class, StringBuilder::class))
|
||||
class C {
|
||||
internal class C {
|
||||
Anon5(1) Deprecated("") private val field1 = 0
|
||||
|
||||
Anon5(1)
|
||||
private val field2 = 0
|
||||
|
||||
Anon5(1) var field3 = 0
|
||||
Anon5(1) internal var field3 = 0
|
||||
|
||||
Anon5(1)
|
||||
var field4 = 0
|
||||
internal var field4 = 0
|
||||
|
||||
Anon6
|
||||
fun foo(Deprecated("") p1: Int, Deprecated("") Anon5(2) p2: Char) {
|
||||
internal fun foo(Deprecated("") p1: Int, Deprecated("") Anon5(2) p2: Char) {
|
||||
@Deprecated("") @Anon5(3) val c = 'a'
|
||||
}
|
||||
|
||||
Anon5(1) fun bar() {
|
||||
Anon5(1) internal fun bar() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(public val value: KClass<*>, public val other: KClass<*>)
|
||||
annotation internal class Ann(val value: KClass<*>, val other: KClass<*>)
|
||||
|
||||
Ann(other = String::class, value = Any::class)
|
||||
class C
|
||||
internal class C
|
||||
@@ -1,9 +1,9 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(public vararg val value: KClass<*>)
|
||||
annotation internal class Ann(vararg val value: KClass<*>)
|
||||
|
||||
Ann(String::class, Any::class)
|
||||
class C
|
||||
internal class C
|
||||
|
||||
Ann
|
||||
class D
|
||||
internal class D
|
||||
@@ -2,23 +2,23 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
package test
|
||||
|
||||
public class Test(str: String) {
|
||||
var myStr = "String2"
|
||||
class Test(str: String) {
|
||||
internal var myStr = "String2"
|
||||
|
||||
init {
|
||||
myStr = str
|
||||
}
|
||||
|
||||
public fun sout(str: String) {
|
||||
fun sout(str: String) {
|
||||
// UNNECESSARY_NOT_NULL_ASSERTION heuristic does not work any more, instead we can skip generating !! altogether
|
||||
println(str)
|
||||
}
|
||||
|
||||
public fun dummy(str: String): String {
|
||||
fun dummy(str: String): String {
|
||||
return str
|
||||
}
|
||||
|
||||
public fun test() {
|
||||
fun test() {
|
||||
sout("String")
|
||||
val test: String = "String2"
|
||||
sout(test)
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun execute() {
|
||||
internal class Foo {
|
||||
internal fun execute() {
|
||||
}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
var fooNotNull = Foo()
|
||||
var fooNullable: Foo? = null
|
||||
internal class Bar {
|
||||
internal var fooNotNull = Foo()
|
||||
internal var fooNullable: Foo? = null
|
||||
}
|
||||
|
||||
class Test {
|
||||
public fun test(barNotNull: Bar, barNullable: Bar?) {
|
||||
internal class Test {
|
||||
fun test(barNotNull: Bar, barNullable: Bar?) {
|
||||
barNotNull.fooNotNull.execute()
|
||||
barNotNull.fooNullable!!.execute()
|
||||
barNullable!!.fooNotNull.execute()
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
package test
|
||||
|
||||
public class Test(str: String?) {
|
||||
var myStr: String? = "String2"
|
||||
class Test(str: String?) {
|
||||
internal var myStr: String? = "String2"
|
||||
|
||||
init {
|
||||
myStr = str
|
||||
}
|
||||
|
||||
public fun sout(str: String?) {
|
||||
fun sout(str: String?) {
|
||||
println(str)
|
||||
}
|
||||
|
||||
public fun dummy(str: String?): String? {
|
||||
fun dummy(str: String?): String? {
|
||||
return str
|
||||
}
|
||||
|
||||
public fun test() {
|
||||
fun test() {
|
||||
sout("String")
|
||||
val test: String? = "String2"
|
||||
sout(test)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
class C Deprecated("")
|
||||
internal class C Deprecated("")
|
||||
constructor()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
var str: String
|
||||
internal class Test {
|
||||
internal var str: String
|
||||
|
||||
init {
|
||||
str = "Ola"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
object Test {
|
||||
var str: String
|
||||
internal object Test {
|
||||
internal var str: String
|
||||
|
||||
init {
|
||||
str = "Ola"
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
fun fromArrayToCollection(a: Array<Foo>) {
|
||||
internal fun fromArrayToCollection(a: Array<Foo>) {
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
import java.util.HashSet
|
||||
|
||||
class Foo {
|
||||
fun foo(o: HashSet<Any?>?) {
|
||||
internal class Foo {
|
||||
internal fun foo(o: HashSet<Any?>?) {
|
||||
val o2: HashSet<Any?>? = o
|
||||
var foo: Int = 0
|
||||
foo = o2!!.size()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.util.HashSet
|
||||
|
||||
class Foo {
|
||||
fun foo(o: HashSet<Any>) {
|
||||
internal class Foo {
|
||||
internal fun foo(o: HashSet<Any>) {
|
||||
val o2 = o
|
||||
var foo = 0
|
||||
foo = o2.size()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun foo() {
|
||||
internal fun foo() {
|
||||
run {
|
||||
val a = 1
|
||||
bar(a)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class Boxing {
|
||||
fun test() {
|
||||
internal class Boxing {
|
||||
internal fun test() {
|
||||
var i: Int? = 0
|
||||
val n = 0.0f
|
||||
i = 1
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: public open fun valueOf(p0: kotlin.Short): kotlin.Short! defined in java.lang.Short public open fun valueOf(p0: kotlin.String!): kotlin.Short! defined in java.lang.Short
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
internal class Test {
|
||||
internal fun test() {
|
||||
val i = Integer.valueOf(100)
|
||||
val s = 3
|
||||
val ss = java.lang.Short.valueOf(s)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
object Library {
|
||||
val ourOut: java.io.PrintStream
|
||||
internal object Library {
|
||||
internal val ourOut: java.io.PrintStream
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
Library.ourOut.print(1)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
object Library {
|
||||
fun call() {
|
||||
internal object Library {
|
||||
internal fun call() {
|
||||
}
|
||||
|
||||
fun getString(): String {
|
||||
internal fun getString(): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
Library.call()
|
||||
Library.getString().isEmpty()
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
class Library {
|
||||
fun call() {
|
||||
internal class Library {
|
||||
internal fun call() {
|
||||
}
|
||||
|
||||
fun getString(): String? {
|
||||
internal fun getString(): String? {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
val lib: Library = Library()
|
||||
lib.call()
|
||||
lib.getString()!!.isEmpty()
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
class Library {
|
||||
fun call() {
|
||||
internal class Library {
|
||||
internal fun call() {
|
||||
}
|
||||
|
||||
fun getString(): String {
|
||||
internal fun getString(): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
val lib = Library()
|
||||
lib.call()
|
||||
lib.getString().isEmpty()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
class Library {
|
||||
public val myString: String
|
||||
internal class Library {
|
||||
val myString: String
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
Library().myString.isEmpty()
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
package test
|
||||
|
||||
public class Short(s: String) {
|
||||
class Short(s: String) {
|
||||
companion object {
|
||||
public fun valueOf(value: String): Short {
|
||||
fun valueOf(value: String): Short {
|
||||
return Short(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Test {
|
||||
public fun test() {
|
||||
internal object Test {
|
||||
fun test() {
|
||||
test.Short.valueOf("1")
|
||||
test.Short.valueOf("1")
|
||||
java.lang.Short.valueOf("1")
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
abstract class A {
|
||||
abstract fun callme()
|
||||
internal abstract class A {
|
||||
internal abstract fun callme()
|
||||
|
||||
fun callmetoo() {
|
||||
internal fun callmetoo() {
|
||||
print("This is a concrete method.")
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
abstract class Shape {
|
||||
public var color: String
|
||||
public abstract fun area(): Double
|
||||
internal abstract class Shape {
|
||||
var color: String
|
||||
abstract fun area(): Double
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class Test
|
||||
internal class Test
|
||||
@@ -1,10 +1,10 @@
|
||||
class T {
|
||||
fun main() {
|
||||
internal class T {
|
||||
internal fun main() {
|
||||
}
|
||||
|
||||
fun i(): Int {
|
||||
internal fun i(): Int {
|
||||
}
|
||||
|
||||
fun s(): String {
|
||||
internal fun s(): String {
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
class T {
|
||||
var a = "abc"
|
||||
var b = 10
|
||||
internal class T {
|
||||
internal var a = "abc"
|
||||
internal var b = 10
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
class T {
|
||||
var a: String
|
||||
var b: String
|
||||
var c = "abc"
|
||||
internal class T {
|
||||
internal var a: String
|
||||
internal var b: String
|
||||
internal var c = "abc"
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class A
|
||||
internal class A
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class A : Base(), I
|
||||
internal class A : Base(), I
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class A : Base(), I0, I1, I2
|
||||
internal class A : Base(), I0, I1, I2
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class Test
|
||||
internal class Test
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class Entry<K, V>
|
||||
internal class Entry<K, V>
|
||||
@@ -1,3 +1,3 @@
|
||||
interface A {
|
||||
public class B
|
||||
internal interface A {
|
||||
class B
|
||||
}
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
inner class B
|
||||
internal class A {
|
||||
internal inner class B
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
enum class E {
|
||||
internal class A {
|
||||
internal enum class E {
|
||||
A,
|
||||
B,
|
||||
C
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
interface I
|
||||
internal class A {
|
||||
internal interface I
|
||||
}
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
class S {
|
||||
class Inner
|
||||
internal class S {
|
||||
internal class Inner
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class Test
|
||||
internal class Test
|
||||
+5
-5
@@ -4,16 +4,16 @@ package demo
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
class Test {
|
||||
constructor() {
|
||||
internal class Test {
|
||||
internal constructor() {
|
||||
}
|
||||
|
||||
constructor(s: String) {
|
||||
internal constructor(s: String) {
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
fun main() {
|
||||
internal class User {
|
||||
internal fun main() {
|
||||
val m = HashMap(1)
|
||||
val m2 = HashMap(10)
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
open class Base {
|
||||
internal open class Base {
|
||||
companion object {
|
||||
public val CONSTANT: Int = 10
|
||||
val CONSTANT: Int = 10
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun foo() {
|
||||
internal class Derived : Base() {
|
||||
internal fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class S {
|
||||
fun sB(): Boolean {
|
||||
internal class S {
|
||||
internal fun sB(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
var myI = 10
|
||||
internal var myI = 10
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
object S {
|
||||
fun staticF(): Boolean {
|
||||
internal object S {
|
||||
internal fun staticF(): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
class S {
|
||||
fun sB(): Boolean {
|
||||
internal class S {
|
||||
internal fun sB(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun sI(): Int {
|
||||
internal fun sI(): Int {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public class MyClass {
|
||||
class MyClass {
|
||||
private fun init(arg1: Int, arg2: Int, arg3: Int) {
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
public class Test
|
||||
class Test
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class A : Base()
|
||||
internal class A : Base()
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
object S {
|
||||
fun sB(): Boolean {
|
||||
internal object S {
|
||||
internal fun sB(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun sI(): Int {
|
||||
internal fun sI(): Int {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
object Util {
|
||||
public fun util1() {
|
||||
internal object Util {
|
||||
fun util1() {
|
||||
}
|
||||
|
||||
public fun util2() {
|
||||
fun util2() {
|
||||
}
|
||||
|
||||
public val CONSTANT: Int = 10
|
||||
val CONSTANT: Int = 10
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
object Util {
|
||||
internal object Util {
|
||||
|
||||
public fun util1() {
|
||||
fun util1() {
|
||||
}
|
||||
|
||||
public fun util2() {
|
||||
fun util2() {
|
||||
}
|
||||
|
||||
public val CONSTANT: Int = 10
|
||||
val CONSTANT: Int = 10
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
object Util {
|
||||
public fun util1() {
|
||||
internal object Util {
|
||||
fun util1() {
|
||||
}
|
||||
|
||||
public fun util2() {
|
||||
fun util2() {
|
||||
}
|
||||
|
||||
public val CONSTANT: Int = 10
|
||||
val CONSTANT: Int = 10
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
public object A {
|
||||
JvmStatic public fun main(args: Array<String>) {
|
||||
object A {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
println(Void.TYPE)
|
||||
println(Integer.TYPE)
|
||||
println(java.lang.Double.TYPE)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.File
|
||||
|
||||
class C {
|
||||
fun foo(file: File): String {
|
||||
internal class C {
|
||||
internal fun foo(file: File): String {
|
||||
val parent = file.parentFile ?: return ""
|
||||
return parent.name
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C {
|
||||
fun foo(s: String?): String {
|
||||
internal class C {
|
||||
internal fun foo(s: String?): String {
|
||||
return s ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.File
|
||||
|
||||
class C {
|
||||
fun foo(file: File?) {
|
||||
internal class C {
|
||||
internal fun foo(file: File?) {
|
||||
file?.delete()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
class C {
|
||||
fun foo(o: Any) {
|
||||
internal class C {
|
||||
internal fun foo(o: Any) {
|
||||
if (o !is String) return
|
||||
println("String")
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C {
|
||||
fun foo(o: Any) {
|
||||
internal class C {
|
||||
internal fun foo(o: Any) {
|
||||
if (o is String) {
|
||||
val l = o.length()
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
class C {
|
||||
fun foo(o: Any) {
|
||||
internal class C {
|
||||
internal fun foo(o: Any) {
|
||||
if (o is String) {
|
||||
val l = o.length()
|
||||
val substring = o.substring(l - 2)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import javaApi.Base
|
||||
|
||||
class C : Base() {
|
||||
public fun f() {
|
||||
internal class C : Base() {
|
||||
fun f() {
|
||||
val other = Base()
|
||||
val value = other.property + property
|
||||
other.property = 1
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ package foo
|
||||
import java.util.ArrayList // we need ArrayList
|
||||
|
||||
// let's declare a class:
|
||||
class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
|
||||
fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
internal class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
|
||||
internal fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
// let's print something:
|
||||
println("1") // print 1
|
||||
println("2") // print 2
|
||||
|
||||
+5
-5
@@ -2,20 +2,20 @@
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun /* nothing to return */ foo(/* no parameters at all */) {
|
||||
internal class A {
|
||||
internal fun /* nothing to return */ foo(/* no parameters at all */) {
|
||||
// let declare a variable
|
||||
// with 2 comments before
|
||||
val /*int*/ a /* it's a */ = 2 /* it's 2 */ + 1 /* it's 1 */ // variable a declared
|
||||
} // end of foo
|
||||
|
||||
fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
|
||||
internal fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
|
||||
/* body is empty */
|
||||
}
|
||||
|
||||
private /*it's private*/ val field = 0
|
||||
|
||||
public /*it's public*/ fun foo(s: String): Char {
|
||||
/*it's public*/ fun foo(s: String): Char {
|
||||
}
|
||||
|
||||
protected /*it's protected*/ fun foo(c: Char) {
|
||||
@@ -23,6 +23,6 @@ class A {
|
||||
|
||||
companion object {
|
||||
|
||||
public /*it's public*//*and static*//*and final*/ val C: Int = 1
|
||||
/*it's public*//*and static*//*and final*/ val C: Int = 1
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class B {
|
||||
private int x;
|
||||
|
||||
// this constructor will disappear
|
||||
B(int x) {
|
||||
public B(int x) {
|
||||
this.x = x;
|
||||
} // end of constructor body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A// this is a primary constructor
|
||||
JvmOverloads constructor(p: Int = 1) {
|
||||
internal class A// this is a primary constructor
|
||||
JvmOverloads internal constructor(p: Int = 1) {
|
||||
private val v: Int
|
||||
|
||||
init {
|
||||
@@ -7,15 +7,15 @@ JvmOverloads constructor(p: Int = 1) {
|
||||
} // end of primary constructor body
|
||||
|
||||
// this is a secondary constructor 2
|
||||
constructor(s: String) : this(s.length()) {
|
||||
internal constructor(s: String) : this(s.length()) {
|
||||
} // end of secondary constructor 2 body
|
||||
}// this is a secondary constructor 1
|
||||
// end of secondary constructor 1 body
|
||||
|
||||
class B// this constructor will disappear
|
||||
internal class B// this constructor will disappear
|
||||
(private val x: Int) // end of constructor body
|
||||
{
|
||||
|
||||
fun foo() {
|
||||
internal fun foo() {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
internal class A {
|
||||
private val isOpen = true // ideally should be atomic boolean
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ public var p3: Int)
|
||||
internal class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ var p3: Int)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun foo(b: Boolean) {
|
||||
internal fun foo(b: Boolean) {
|
||||
if (b)
|
||||
println("true")
|
||||
else
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package pack
|
||||
|
||||
class C JvmOverloads constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
|
||||
internal class C JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
|
||||
|
||||
public object User {
|
||||
public fun main() {
|
||||
object User {
|
||||
fun main() {
|
||||
val c1 = C(100, 100, 100)
|
||||
val c2 = C(100, 100)
|
||||
val c3 = C(100)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class C(val myArg1: Int) {
|
||||
var myArg2: Int = 0
|
||||
var myArg3: Int = 0
|
||||
internal class C internal constructor(internal val myArg1: Int) {
|
||||
internal var myArg2: Int = 0
|
||||
internal var myArg3: Int = 0
|
||||
|
||||
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
|
||||
internal constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = arg3
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1) {
|
||||
internal constructor(arg1: Int, arg2: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = 0
|
||||
}
|
||||
@@ -18,8 +18,8 @@ class C(val myArg1: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
public object User {
|
||||
public fun main() {
|
||||
object User {
|
||||
fun main() {
|
||||
val c1 = C(100, 100, 100)
|
||||
val c2 = C(100, 100)
|
||||
val c3 = C(100)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
public class Test {
|
||||
class Test {
|
||||
private val s: String
|
||||
var b: Boolean = false
|
||||
var d: Double = 0.toDouble()
|
||||
internal var b: Boolean = false
|
||||
internal var d: Double = 0.toDouble()
|
||||
|
||||
public constructor() {
|
||||
constructor() {
|
||||
b = true
|
||||
}
|
||||
|
||||
public constructor(s: String) {
|
||||
constructor(s: String) {
|
||||
this.s = s
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
class C(arg1: Int, arg2: Int, arg3: Int) {
|
||||
internal class C internal constructor(arg1: Int, arg2: Int, arg3: Int) {
|
||||
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
|
||||
internal constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
|
||||
println()
|
||||
}
|
||||
|
||||
constructor(arg1: Int) : this(arg1, 0) {
|
||||
internal constructor(arg1: Int) : this(arg1, 0) {
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
public object User {
|
||||
public fun main() {
|
||||
object User {
|
||||
fun main() {
|
||||
val c1 = C(1, 2, 3)
|
||||
val c2 = C(5, 6)
|
||||
val c3 = C(7)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import javaApi.Anon5
|
||||
|
||||
class A
|
||||
internal class A
|
||||
Anon5(10)
|
||||
constructor(private val a: Int, private val b: Int) {
|
||||
|
||||
Deprecated("") // this constructor will not be replaced by default parameter value in primary because of this annotation
|
||||
public constructor(a: Int) : this(a, 1) {
|
||||
constructor(a: Int) : this(a, 1) {
|
||||
}
|
||||
}
|
||||
|
||||
class B Anon5(11)
|
||||
internal class B Anon5(11)
|
||||
constructor()
|
||||
|
||||
class C Anon5(12)
|
||||
internal class C Anon5(12)
|
||||
private constructor()
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.test.customer
|
||||
|
||||
class Customer(public val firstName: String, public val lastName: String) {
|
||||
internal class Customer internal constructor(val firstName: String, val lastName: String) {
|
||||
|
||||
init {
|
||||
doSmthBefore()
|
||||
@@ -14,27 +14,27 @@ class Customer(public val firstName: String, public val lastName: String) {
|
||||
}
|
||||
}
|
||||
|
||||
class CustomerBuilder {
|
||||
public var _firstName: String = "Homer"
|
||||
public var _lastName: String = "Simpson"
|
||||
internal class CustomerBuilder {
|
||||
var _firstName: String = "Homer"
|
||||
var _lastName: String = "Simpson"
|
||||
|
||||
public fun WithFirstName(firstName: String): CustomerBuilder {
|
||||
fun WithFirstName(firstName: String): CustomerBuilder {
|
||||
_firstName = firstName
|
||||
return this
|
||||
}
|
||||
|
||||
public fun WithLastName(lastName: String): CustomerBuilder {
|
||||
fun WithLastName(lastName: String): CustomerBuilder {
|
||||
_lastName = lastName
|
||||
return this
|
||||
}
|
||||
|
||||
public fun Build(): Customer {
|
||||
fun Build(): Customer {
|
||||
return Customer(_firstName, _lastName)
|
||||
}
|
||||
}
|
||||
|
||||
public object User {
|
||||
public fun main() {
|
||||
object User {
|
||||
fun main() {
|
||||
val customer = CustomerBuilder().WithFirstName("Homer").WithLastName("Simpson").Build()
|
||||
println(customer.firstName)
|
||||
println(customer.lastName)
|
||||
|
||||
@@ -1 +1 @@
|
||||
class C(private val p1: Int, private val myP2: Int, public var p3: Int)
|
||||
internal class C(private val p1: Int, private val myP2: Int, var p3: Int)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class C(private val field: Int) {
|
||||
internal class C(private val field: Int) {
|
||||
|
||||
init {
|
||||
println(field)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class C(p: Int) {
|
||||
internal class C(p: Int) {
|
||||
private val p: Int
|
||||
|
||||
init {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C(p: Int, c: C) {
|
||||
public var p: Int = 0
|
||||
internal class C(p: Int, c: C) {
|
||||
var p: Int = 0
|
||||
|
||||
init {
|
||||
c.p = p
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C(p: Int) {
|
||||
public var p: Int = 0
|
||||
internal class C(p: Int) {
|
||||
var p: Int = 0
|
||||
|
||||
init {
|
||||
this.p = 0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user