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