J2K: all annotations should be with "@"
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
annotation internal class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
|
||||
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // 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)
|
||||
annotation internal class I
|
||||
internal annotation class I
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
annotation internal class J
|
||||
internal annotation class J
|
||||
|
||||
@Target
|
||||
annotation internal class K
|
||||
internal annotation class K
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
annotation internal class Anon(val s: String = "a", val stringArray: Array<String> = arrayOf("a", "b"), val intArray: IntArray)
|
||||
internal annotation 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))
|
||||
internal class A
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ERROR: Body is not allowed for annotation class
|
||||
// ERROR: Modifier 'companion' is not applicable inside 'annotation class'
|
||||
annotation internal class Anon(val value: String) {
|
||||
internal annotation class Anon(val value: String) {
|
||||
|
||||
enum class E {
|
||||
A, B
|
||||
@@ -12,7 +12,7 @@ annotation internal class Anon(val value: String) {
|
||||
}
|
||||
}
|
||||
|
||||
Anon("a")
|
||||
@Anon("a")
|
||||
internal interface I {
|
||||
companion object {
|
||||
val e: Anon.E = Anon.field
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
annotation internal class Anon(vararg val value: String, val x: Int = 1)
|
||||
internal annotation class Anon(vararg val value: String, val x: Int = 1)
|
||||
|
||||
Anon("a", "b")
|
||||
@Anon("a", "b")
|
||||
internal interface I1
|
||||
|
||||
Anon("c", "d", x = 1)
|
||||
@Anon("c", "d", x = 1)
|
||||
internal interface I2
|
||||
|
||||
Anon("c", "d", x = 1)
|
||||
@Anon("c", "d", x = 1)
|
||||
internal interface I3
|
||||
|
||||
Anon(value = *arrayOf("c", "d"))
|
||||
@Anon(value = *arrayOf("c", "d"))
|
||||
internal interface I4
|
||||
|
||||
+15
-15
@@ -3,30 +3,30 @@
|
||||
// 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")
|
||||
Anon2(value = "a", intValue = 1, charValue = 'a')
|
||||
Anon3(e = E.A, stringArray = arrayOf(), value = *arrayOf("a", "b"))
|
||||
Anon4("x", "y")
|
||||
Anon5(1)
|
||||
Anon6("x", "y")
|
||||
Anon7(String::class, StringBuilder::class)
|
||||
Anon8(classes = arrayOf(String::class, StringBuilder::class))
|
||||
@Anon1(value = *arrayOf("a"), stringArray = arrayOf("b"), intArray = intArrayOf(1, 2), string = "x")
|
||||
@Anon2(value = "a", intValue = 1, charValue = 'a')
|
||||
@Anon3(e = E.A, stringArray = arrayOf(), value = *arrayOf("a", "b"))
|
||||
@Anon4("x", "y")
|
||||
@Anon5(1)
|
||||
@Anon6("x", "y")
|
||||
@Anon7(String::class, StringBuilder::class)
|
||||
@Anon8(classes = arrayOf(String::class, StringBuilder::class))
|
||||
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
|
||||
|
||||
Anon5(1) internal var field3 = 0
|
||||
@Anon5(1) internal var field3 = 0
|
||||
|
||||
Anon5(1)
|
||||
@Anon5(1)
|
||||
internal var field4 = 0
|
||||
|
||||
Anon6
|
||||
internal fun foo(Deprecated("") p1: Int, Deprecated("") Anon5(2) p2: Char) {
|
||||
@Anon6
|
||||
internal fun foo(@Deprecated("") p1: Int, @Deprecated("") @Anon5(2) p2: Char) {
|
||||
@Deprecated("") @Anon5(3) val c = 'a'
|
||||
}
|
||||
|
||||
Anon5(1) internal fun bar() {
|
||||
@Anon5(1) internal fun bar() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation internal class Ann(val value: KClass<*>, val other: KClass<*>)
|
||||
internal annotation class Ann(val value: KClass<*>, val other: KClass<*>)
|
||||
|
||||
Ann(other = String::class, value = Any::class)
|
||||
@Ann(other = String::class, value = Any::class)
|
||||
internal class C
|
||||
@@ -1,9 +1,9 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation internal class Ann(vararg val value: KClass<*>)
|
||||
internal annotation class Ann(vararg val value: KClass<*>)
|
||||
|
||||
Ann(String::class, Any::class)
|
||||
@Ann(String::class, Any::class)
|
||||
internal class C
|
||||
|
||||
Ann
|
||||
@Ann
|
||||
internal class D
|
||||
@@ -1,2 +1,2 @@
|
||||
internal class C Deprecated("")
|
||||
internal class C @Deprecated("")
|
||||
constructor()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
object A {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
println(Void.TYPE)
|
||||
println(Integer.TYPE)
|
||||
println(java.lang.Double.TYPE)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
internal class A// this is a primary constructor
|
||||
JvmOverloads internal constructor(p: Int = 1) {
|
||||
@JvmOverloads internal constructor(p: Int = 1) {
|
||||
private val v: Int
|
||||
|
||||
init {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
|
||||
internal class C @JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
|
||||
|
||||
object User {
|
||||
fun main() {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import javaApi.Anon5
|
||||
|
||||
internal class A
|
||||
Anon5(10)
|
||||
@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
|
||||
@Deprecated("") // this constructor will not be replaced by default parameter value in primary because of this annotation
|
||||
constructor(a: Int) : this(a, 1) {
|
||||
}
|
||||
}
|
||||
|
||||
internal class B Anon5(11)
|
||||
internal class B @Anon5(11)
|
||||
constructor()
|
||||
|
||||
internal class C Anon5(12)
|
||||
internal class C @Anon5(12)
|
||||
private constructor()
|
||||
@@ -1 +1 @@
|
||||
internal class C JvmOverloads constructor(private val string: String, a: Int = string.length())
|
||||
internal class C @JvmOverloads constructor(private val string: String, a: Int = string.length())
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import java.lang.SuppressWarnings
|
||||
|
||||
internal class C(Deprecated("") private val p1: Int, Deprecated("") private val myP2: Int, Deprecated("") SuppressWarnings("x") var p3: Int)
|
||||
internal class C(@Deprecated("") private val p1: Int, @Deprecated("") private val myP2: Int, @Deprecated("") @SuppressWarnings("x") var p3: Int)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
internal class A JvmOverloads internal constructor(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
|
||||
internal class A @JvmOverloads internal constructor(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
|
||||
|
||||
internal class Nested internal constructor(p: Int) {
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
import A.Nested
|
||||
|
||||
internal class A JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
|
||||
internal class Nested internal constructor(p: Int) {
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package pack
|
||||
|
||||
import pack.A.Nested
|
||||
|
||||
internal class A JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
|
||||
internal class Nested internal constructor(p: Int) {
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package pack
|
||||
|
||||
import pack.A.*
|
||||
|
||||
internal class A JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
|
||||
|
||||
internal class Nested internal constructor(p: Int) {
|
||||
companion object {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
internal constructor(a: Int) : this(a, 0, 0, 0, 1) {
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
internal constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
|
||||
|
||||
internal constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
|
||||
internal class C @JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package pack
|
||||
|
||||
internal class C JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
|
||||
internal class C @JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
internal class C JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
|
||||
internal class C @JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
|
||||
private val field: Int
|
||||
|
||||
init {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ internal class A {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
JvmOverloads constructor(p: Int, s: String, x: Int = 1) {
|
||||
@JvmOverloads constructor(p: Int, s: String, x: Int = 1) {
|
||||
this.s = s
|
||||
this.x = x
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ internal class A() {
|
||||
private val s = ""
|
||||
private val x = 0
|
||||
|
||||
JvmOverloads constructor(p: Int, s: String, x: Int = 1) : this() {
|
||||
@JvmOverloads constructor(p: Int, s: String, x: Int = 1) : this() {
|
||||
this.s = s
|
||||
this.x = x
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* This is a deprecated class.
|
||||
*/
|
||||
Deprecated("do not use")
|
||||
@Deprecated("do not use")
|
||||
internal class C
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Deprecated("do not use")
|
||||
@Deprecated("do not use")
|
||||
internal class C
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
class C JvmOverloads internal constructor(c: C, val x: Int = c.x)
|
||||
class C @JvmOverloads internal constructor(c: C, val x: Int = c.x)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// ERROR: This annotation is not applicable to target 'member property'
|
||||
internal class A {
|
||||
Deprecated("")
|
||||
Volatile internal var field1 = 0
|
||||
@Deprecated("")
|
||||
@Volatile internal var field1 = 0
|
||||
|
||||
Transient internal var field2 = 1
|
||||
@Transient internal var field2 = 1
|
||||
|
||||
// Should work even for bad modifiers
|
||||
Strictfp internal var field3 = 2.0
|
||||
@Strictfp internal var field3 = 2.0
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object TestClass {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
var i = 0
|
||||
while (i < 10) {
|
||||
if (i == 4 || i == 8) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object TestClass {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
var i = 0
|
||||
var j = 1
|
||||
while (i < 10) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object TestClass {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
var i = 1
|
||||
while (i < 1000) {
|
||||
if (i == 4 || i == 8) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object TestClass {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
var i = 1
|
||||
OuterLoop1@ OuterLoop2@ while (i < 1000) {
|
||||
var j = 1
|
||||
|
||||
@@ -11,7 +11,7 @@ internal class Test : Base() {
|
||||
return super.equals(o)
|
||||
}
|
||||
|
||||
Throws(CloneNotSupportedException::class)
|
||||
@Throws(CloneNotSupportedException::class)
|
||||
override fun clone(): Any {
|
||||
return super.clone()
|
||||
}
|
||||
@@ -20,7 +20,7 @@ internal class Test : Base() {
|
||||
return super.toString()
|
||||
}
|
||||
|
||||
Throws(Throwable::class)
|
||||
@Throws(Throwable::class)
|
||||
override fun finalize() {
|
||||
super.finalize()
|
||||
}
|
||||
@@ -35,7 +35,7 @@ internal open class Base {
|
||||
return super.equals(o)
|
||||
}
|
||||
|
||||
Throws(CloneNotSupportedException::class)
|
||||
@Throws(CloneNotSupportedException::class)
|
||||
protected open fun clone(): Any {
|
||||
return super.clone()
|
||||
}
|
||||
@@ -44,7 +44,7 @@ internal open class Base {
|
||||
return super.toString()
|
||||
}
|
||||
|
||||
Throws(Throwable::class)
|
||||
@Throws(Throwable::class)
|
||||
protected open fun finalize() {
|
||||
super.finalize()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
object A {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// !forceNotNullTypes: false
|
||||
object A {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -12,14 +12,14 @@ internal class X {
|
||||
return super.toString()
|
||||
}
|
||||
|
||||
Throws(CloneNotSupportedException::class)
|
||||
@Throws(CloneNotSupportedException::class)
|
||||
protected fun clone(): Any {
|
||||
return super.clone()
|
||||
}
|
||||
}
|
||||
|
||||
internal class Y : Thread() {
|
||||
Throws(CloneNotSupportedException::class)
|
||||
@Throws(CloneNotSupportedException::class)
|
||||
override fun clone(): Any {
|
||||
return super.clone()
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ internal class X : Base() {
|
||||
return super.toString()
|
||||
}
|
||||
|
||||
Throws(CloneNotSupportedException::class)
|
||||
@Throws(CloneNotSupportedException::class)
|
||||
protected fun clone(): Any {
|
||||
return super.clone()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
internal class A {
|
||||
Synchronized internal fun foo() {
|
||||
@Synchronized internal fun foo() {
|
||||
bar()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
Throws(IOException::class, SerializationException::class)
|
||||
@Throws(IOException::class, SerializationException::class)
|
||||
internal fun foo()
|
||||
+1
-1
@@ -21,7 +21,7 @@ class Identifier<T> {
|
||||
}
|
||||
|
||||
object User {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
val i1 = Identifier("name", false, true)
|
||||
val i2 = Identifier("name", false)
|
||||
val i3 = Identifier("name")
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import java.io.*
|
||||
|
||||
internal object FileRead {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
try {
|
||||
val fstream = FileInputStream()
|
||||
val `in` = DataInputStream(fstream)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package demo
|
||||
|
||||
internal object Program {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
println("Halo!")
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
internal object X {
|
||||
Throws(Exception::class)
|
||||
@Throws(Exception::class)
|
||||
internal fun <T> foo(constructor: Constructor<T>, args1: Array<Any>, args2: Array<Any>) {
|
||||
constructor.newInstance(*args1)
|
||||
constructor.newInstance(args1, args2)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// ERROR: Type mismatch: inferred type is kotlin.Any? but kotlin.Any was expected
|
||||
// ERROR: Type mismatch: inferred type is kotlin.Any? but kotlin.Any was expected
|
||||
internal class A {
|
||||
JvmOverloads internal fun foo(s: String? = null): Any {
|
||||
@JvmOverloads internal fun foo(s: String? = null): Any {
|
||||
println("s = " + s!!)
|
||||
return ""
|
||||
}
|
||||
@@ -24,7 +24,7 @@ internal class A {
|
||||
return bar1(null)
|
||||
}
|
||||
|
||||
Deprecated("")
|
||||
@Deprecated("")
|
||||
fun f() {
|
||||
f(1)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
internal class A {
|
||||
JvmOverloads internal fun foo(i: Int, c: Char = 'a', s: String = "") {
|
||||
@JvmOverloads internal fun foo(i: Int, c: Char = 'a', s: String = "") {
|
||||
println("foo" + i + c + s)
|
||||
}
|
||||
|
||||
JvmOverloads internal fun bar(s: String? = null): Int {
|
||||
@JvmOverloads internal fun bar(s: String? = null): Int {
|
||||
println("s = " + s!!)
|
||||
return 0
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ internal class A {
|
||||
println("p = [$p]")
|
||||
}
|
||||
|
||||
Synchronized fun foo() {
|
||||
@Synchronized fun foo() {
|
||||
foo(calcSomething())
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ object SwitchDemo {
|
||||
println(monthString)
|
||||
}
|
||||
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
for (i in 1..12)
|
||||
test(i)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object NonDefault {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
|
||||
val value = 3
|
||||
val valueString = ""
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package switch_demo
|
||||
|
||||
object SwitchDemo {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
val month = 8
|
||||
val monthString: String
|
||||
when (month) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object C {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
when (args.size()) {
|
||||
1 -> {
|
||||
run {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package switch_demo
|
||||
|
||||
object SwitchDemo {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
|
||||
val month = 8
|
||||
val monthString: String
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
object NonDefault {
|
||||
JvmStatic fun main(args: Array<String>) {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
|
||||
val value = 3
|
||||
var valueString = ""
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import java.io.*
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.*
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { input ->
|
||||
ByteArrayOutputStream().use { output ->
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import java.io.*
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream -> println(stream.read()) }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.*
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import java.io.*
|
||||
|
||||
internal interface I {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
fun doIt(stream: InputStream): Int
|
||||
}
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
bar(object : I {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
override fun doIt(stream: InputStream): Int {
|
||||
return stream.available()
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class C {
|
||||
}
|
||||
}
|
||||
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun bar(i: I, stream: InputStream): Int {
|
||||
return i.doIt(stream)
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import java.io.*
|
||||
|
||||
internal interface I {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
fun doIt(stream: InputStream): Int
|
||||
}
|
||||
|
||||
class C {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun foo(): Int {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
return bar(object : I {
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
override fun doIt(stream: InputStream): Int {
|
||||
return stream.available()
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class C {
|
||||
}
|
||||
}
|
||||
|
||||
Throws(IOException::class)
|
||||
@Throws(IOException::class)
|
||||
internal fun bar(i: I, stream: InputStream): Int {
|
||||
return i.doIt(stream)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user