J2K: all annotations should be with "@"
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ internal class C {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
JvmStatic 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 internal class Ann(val value: KClass<Any>)
|
internal annotation class Ann(val value: KClass<Any>)
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
Ann(String::class)
|
@Ann(String::class)
|
||||||
class X
|
class X
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
package to
|
package to
|
||||||
|
|
||||||
Volatile internal var field = 1
|
@Volatile internal var field = 1
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package to
|
package to
|
||||||
|
|
||||||
object JavaClass {
|
object JavaClass {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
println("Hello, world!")
|
println("Hello, world!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package to
|
package to
|
||||||
|
|
||||||
SomeAnnotation
|
@SomeAnnotation
|
||||||
fun foo(): String {
|
fun foo(): String {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
if (child is PsiWhiteSpace) !child.isInSingleLine() else false
|
if (child is PsiWhiteSpace) !child.isInSingleLine() else false
|
||||||
}
|
}
|
||||||
|
|
||||||
annotations.map { convertAnnotation(it, withAt = owner is PsiLocalVariable, newLineAfter = newLines) }.filterNotNull() //TODO: '@' is also needed for local classes
|
annotations.map { convertAnnotation(it, newLineAfter = newLines) }.filterNotNull() //TODO: '@' is also needed for local classes
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
listOf()
|
listOf()
|
||||||
@@ -77,14 +77,14 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
LiteralExpression("\"" + StringUtil.escapeStringCharacters(deprecatedTag.content()) + "\"").assignNoPrototype()
|
LiteralExpression("\"" + StringUtil.escapeStringCharacters(deprecatedTag.content()) + "\"").assignNoPrototype()
|
||||||
}
|
}
|
||||||
return Annotation(Identifier("Deprecated").assignPrototype(deprecatedTag.getNameElement()),
|
return Annotation(Identifier("Deprecated").assignPrototype(deprecatedTag.getNameElement()),
|
||||||
listOf(null to deferredExpression), withAt = false, newLineAfter = true)
|
listOf(null to deferredExpression), newLineAfter = true)
|
||||||
.assignPrototype(deprecatedTag)
|
.assignPrototype(deprecatedTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun convertModifiersToAnnotations(owner: PsiModifierListOwner): Annotations {
|
private fun convertModifiersToAnnotations(owner: PsiModifierListOwner): Annotations {
|
||||||
val list = MODIFIER_TO_ANNOTATION
|
val list = MODIFIER_TO_ANNOTATION
|
||||||
.filter { owner.hasModifierProperty(it.first) }
|
.filter { owner.hasModifierProperty(it.first) }
|
||||||
.map { Annotation(Identifier(it.second).assignNoPrototype(), listOf(), withAt = false, newLineAfter = false).assignNoPrototype() }
|
.map { Annotation(Identifier(it.second).assignNoPrototype(), listOf(), newLineAfter = false).assignNoPrototype() }
|
||||||
return Annotations(list).assignNoPrototype()
|
return Annotations(list).assignNoPrototype()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
return expr.referenceName?.let { JavaAnnotationTargetMapper.mapJavaTargetArgumentByName(it) } ?: emptySet()
|
return expr.referenceName?.let { JavaAnnotationTargetMapper.mapJavaTargetArgumentByName(it) } ?: emptySet()
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun convertAnnotation(annotation: PsiAnnotation, withAt: Boolean, newLineAfter: Boolean): Annotation? {
|
public fun convertAnnotation(annotation: PsiAnnotation, newLineAfter: Boolean): Annotation? {
|
||||||
val qualifiedName = annotation.getQualifiedName()
|
val qualifiedName = annotation.getQualifiedName()
|
||||||
if (qualifiedName == CommonClassNames.JAVA_LANG_DEPRECATED && annotation.getParameterList().getAttributes().isEmpty()) {
|
if (qualifiedName == CommonClassNames.JAVA_LANG_DEPRECATED && annotation.getParameterList().getAttributes().isEmpty()) {
|
||||||
val deferredExpression = converter.deferredElement<Expression> { LiteralExpression("\"\"").assignNoPrototype() }
|
val deferredExpression = converter.deferredElement<Expression> { LiteralExpression("\"\"").assignNoPrototype() }
|
||||||
return Annotation(Identifier("Deprecated").assignNoPrototype(), listOf(null to deferredExpression), withAt, newLineAfter).assignPrototype(annotation) //TODO: insert comment
|
return Annotation(Identifier("Deprecated").assignNoPrototype(), listOf(null to deferredExpression), newLineAfter).assignPrototype(annotation) //TODO: insert comment
|
||||||
}
|
}
|
||||||
if (qualifiedName == CommonClassNames.JAVA_LANG_ANNOTATION_TARGET) {
|
if (qualifiedName == CommonClassNames.JAVA_LANG_ANNOTATION_TARGET) {
|
||||||
val attributes = annotation.parameterList.attributes
|
val attributes = annotation.parameterList.attributes
|
||||||
@@ -129,7 +129,7 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Annotation(Identifier("Target").assignNoPrototype(),
|
return Annotation(Identifier("Target").assignNoPrototype(),
|
||||||
deferredExpressionList, true, newLineAfter).assignPrototype(annotation)
|
deferredExpressionList, newLineAfter).assignPrototype(annotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
val nameRef = annotation.getNameReferenceElement()
|
val nameRef = annotation.getNameReferenceElement()
|
||||||
@@ -148,7 +148,7 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
|
|
||||||
attrValues.map { attrName to converter.deferredElement(it) }
|
attrValues.map { attrName to converter.deferredElement(it) }
|
||||||
}
|
}
|
||||||
return Annotation(name, arguments, withAt, newLineAfter).assignPrototype(annotation)
|
return Annotation(name, arguments, newLineAfter).assignPrototype(annotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun convertAnnotationMethodDefault(method: PsiAnnotationMethod): DeferredElement<Expression>? {
|
public fun convertAnnotationMethodDefault(method: PsiAnnotationMethod): DeferredElement<Expression>? {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class Converter private constructor(
|
|||||||
is PsiExpression -> createDefaultCodeConverter().convertExpression(element)
|
is PsiExpression -> createDefaultCodeConverter().convertExpression(element)
|
||||||
is PsiImportList -> convertImportList(element)
|
is PsiImportList -> convertImportList(element)
|
||||||
is PsiImportStatementBase -> convertImport(element, false)
|
is PsiImportStatementBase -> convertImport(element, false)
|
||||||
is PsiAnnotation -> annotationConverter.convertAnnotation(element, withAt = false, newLineAfter = false)
|
is PsiAnnotation -> annotationConverter.convertAnnotation(element, newLineAfter = false)
|
||||||
is PsiPackageStatement -> PackageStatement(quoteKeywords(element.getPackageName() ?: "")).assignPrototype(element)
|
is PsiPackageStatement -> PackageStatement(quoteKeywords(element.getPackageName() ?: "")).assignPrototype(element)
|
||||||
is PsiJavaCodeReferenceElement -> {
|
is PsiJavaCodeReferenceElement -> {
|
||||||
if (element.parent is PsiReferenceList) {
|
if (element.parent is PsiReferenceList) {
|
||||||
@@ -280,10 +280,9 @@ class Converter private constructor(
|
|||||||
classBody = ClassBody(constructorSignature, classBody.baseClassParams, classBody.members,
|
classBody = ClassBody(constructorSignature, classBody.baseClassParams, classBody.members,
|
||||||
classBody.companionObjectMembers, classBody.lBrace, classBody.rBrace, classBody.isEnumBody, classBody.isAnonymousClassBody)
|
classBody.companionObjectMembers, classBody.lBrace, classBody.rBrace, classBody.isEnumBody, classBody.isAnonymousClassBody)
|
||||||
|
|
||||||
val annotationAnnotation = Annotation(Identifier("annotation").assignNoPrototype(), listOf(), withAt = false, newLineAfter = false).assignNoPrototype()
|
|
||||||
return Class(psiClass.declarationIdentifier(),
|
return Class(psiClass.declarationIdentifier(),
|
||||||
convertAnnotations(psiClass) + Annotations(listOf(annotationAnnotation)),
|
convertAnnotations(psiClass),
|
||||||
convertModifiers(psiClass).without(Modifier.ABSTRACT),
|
convertModifiers(psiClass).with(Modifier.ANNOTATION).without(Modifier.ABSTRACT),
|
||||||
TypeParameterList.Empty,
|
TypeParameterList.Empty,
|
||||||
listOf(),
|
listOf(),
|
||||||
null,
|
null,
|
||||||
@@ -427,7 +426,6 @@ class Converter private constructor(
|
|||||||
function.annotations += Annotations(
|
function.annotations += Annotations(
|
||||||
listOf(Annotation(identifier,
|
listOf(Annotation(identifier,
|
||||||
listOf(),
|
listOf(),
|
||||||
withAt = false,
|
|
||||||
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
|
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +433,6 @@ class Converter private constructor(
|
|||||||
function.annotations += Annotations(
|
function.annotations += Annotations(
|
||||||
listOf(Annotation(Identifier("JvmOverloads").assignNoPrototype(),
|
listOf(Annotation(Identifier("JvmOverloads").assignNoPrototype(),
|
||||||
listOf(),
|
listOf(),
|
||||||
withAt = false,
|
|
||||||
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
|
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,7 +583,7 @@ class Converter private constructor(
|
|||||||
val convertedType = typeConverter.convertType(types[index], Nullability.NotNull)
|
val convertedType = typeConverter.convertType(types[index], Nullability.NotNull)
|
||||||
null to deferredElement<Expression> { ClassLiteralExpression(convertedType.assignPrototype(refElements[index])) }
|
null to deferredElement<Expression> { ClassLiteralExpression(convertedType.assignPrototype(refElements[index])) }
|
||||||
}
|
}
|
||||||
val annotation = Annotation(Identifier("Throws").assignNoPrototype(), arguments, withAt = false, newLineAfter = true)
|
val annotation = Annotation(Identifier("Throws").assignNoPrototype(), arguments, newLineAfter = true)
|
||||||
return Annotations(listOf(annotation.assignPrototype(throwsList))).assignPrototype(throwsList)
|
return Annotations(listOf(annotation.assignPrototype(throwsList))).assignPrototype(throwsList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +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 org.jetbrains.kotlin.j2k.append
|
||||||
|
import org.jetbrains.kotlin.j2k.buildList
|
||||||
|
|
||||||
class Annotation(val name: Identifier, val arguments: List<Pair<Identifier?, DeferredElement<Expression>>>, val withAt: Boolean, val newLineAfter: Boolean) : Element() {
|
class Annotation(val name: Identifier, val arguments: List<Pair<Identifier?, DeferredElement<Expression>>>, val newLineAfter: Boolean) : Element() {
|
||||||
override fun generateCode(builder: CodeBuilder) {
|
override fun generateCode(builder: CodeBuilder) {
|
||||||
if (withAt) builder.append("@")
|
builder.append("@")
|
||||||
if (arguments.isEmpty()) {
|
if (arguments.isEmpty()) {
|
||||||
builder.append(name)
|
builder.append(name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ enum class Modifier(val name: String) {
|
|||||||
PROTECTED("protected"),
|
PROTECTED("protected"),
|
||||||
PRIVATE("private"),
|
PRIVATE("private"),
|
||||||
INTERNAL("internal"),
|
INTERNAL("internal"),
|
||||||
|
ANNOTATION("annotation"),
|
||||||
ABSTRACT("abstract"),
|
ABSTRACT("abstract"),
|
||||||
OPEN("open"),
|
OPEN("open"),
|
||||||
OVERRIDE("override"),
|
OVERRIDE("override"),
|
||||||
|
|||||||
@@ -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)
|
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 internal class I
|
internal annotation class I
|
||||||
|
|
||||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||||
annotation internal class J
|
internal annotation class J
|
||||||
|
|
||||||
@Target
|
@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
|
internal class A
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// 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 internal class Anon(val value: String) {
|
internal annotation class Anon(val value: String) {
|
||||||
|
|
||||||
enum class E {
|
enum class E {
|
||||||
A, B
|
A, B
|
||||||
@@ -12,7 +12,7 @@ annotation internal class Anon(val value: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Anon("a")
|
@Anon("a")
|
||||||
internal interface I {
|
internal interface I {
|
||||||
companion object {
|
companion object {
|
||||||
val e: Anon.E = Anon.field
|
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
|
internal interface I1
|
||||||
|
|
||||||
Anon("c", "d", x = 1)
|
@Anon("c", "d", x = 1)
|
||||||
internal interface I2
|
internal interface I2
|
||||||
|
|
||||||
Anon("c", "d", x = 1)
|
@Anon("c", "d", x = 1)
|
||||||
internal interface I3
|
internal interface I3
|
||||||
|
|
||||||
Anon(value = *arrayOf("c", "d"))
|
@Anon(value = *arrayOf("c", "d"))
|
||||||
internal interface I4
|
internal interface I4
|
||||||
|
|||||||
+15
-15
@@ -3,30 +3,30 @@
|
|||||||
// 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")
|
||||||
Anon2(value = "a", intValue = 1, charValue = 'a')
|
@Anon2(value = "a", intValue = 1, charValue = 'a')
|
||||||
Anon3(e = E.A, stringArray = arrayOf(), value = *arrayOf("a", "b"))
|
@Anon3(e = E.A, stringArray = arrayOf(), value = *arrayOf("a", "b"))
|
||||||
Anon4("x", "y")
|
@Anon4("x", "y")
|
||||||
Anon5(1)
|
@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))
|
||||||
internal 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) internal var field3 = 0
|
@Anon5(1) internal var field3 = 0
|
||||||
|
|
||||||
Anon5(1)
|
@Anon5(1)
|
||||||
internal var field4 = 0
|
internal var field4 = 0
|
||||||
|
|
||||||
Anon6
|
@Anon6
|
||||||
internal 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) internal fun bar() {
|
@Anon5(1) internal fun bar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import kotlin.reflect.KClass
|
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
|
internal class C
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import kotlin.reflect.KClass
|
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
|
internal class C
|
||||||
|
|
||||||
Ann
|
@Ann
|
||||||
internal class D
|
internal class D
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
internal class C Deprecated("")
|
internal class C @Deprecated("")
|
||||||
constructor()
|
constructor()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
object A {
|
object A {
|
||||||
JvmStatic 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,5 +1,5 @@
|
|||||||
internal class A// this is a primary constructor
|
internal class A// this is a primary constructor
|
||||||
JvmOverloads internal constructor(p: Int = 1) {
|
@JvmOverloads internal constructor(p: Int = 1) {
|
||||||
private val v: Int
|
private val v: Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package pack
|
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 {
|
object User {
|
||||||
fun main() {
|
fun main() {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import javaApi.Anon5
|
import javaApi.Anon5
|
||||||
|
|
||||||
internal 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
|
||||||
constructor(a: Int) : this(a, 1) {
|
constructor(a: Int) : this(a, 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class B Anon5(11)
|
internal class B @Anon5(11)
|
||||||
constructor()
|
constructor()
|
||||||
|
|
||||||
internal class C Anon5(12)
|
internal class C @Anon5(12)
|
||||||
private constructor()
|
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
|
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) {
|
internal class Nested internal constructor(p: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
// ERROR: Property must be initialized or be abstract
|
// ERROR: Property must be initialized or be abstract
|
||||||
import A.Nested
|
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) {
|
internal class Nested internal constructor(p: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package pack
|
|||||||
|
|
||||||
import pack.A.Nested
|
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) {
|
internal class Nested internal constructor(p: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package pack
|
|||||||
|
|
||||||
import pack.A.*
|
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) {
|
internal class Nested internal constructor(p: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package pack
|
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) {
|
internal constructor(a: Int) : this(a, 0, 0, 0, 1) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package pack
|
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) {
|
internal constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package pack
|
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) {
|
internal constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package pack
|
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
|
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
|
private val field: Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ internal class A {
|
|||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
JvmOverloads constructor(p: Int, s: String, x: Int = 1) {
|
@JvmOverloads constructor(p: Int, s: String, x: Int = 1) {
|
||||||
this.s = s
|
this.s = s
|
||||||
this.x = x
|
this.x = x
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ internal class A() {
|
|||||||
private val s = ""
|
private val s = ""
|
||||||
private val x = 0
|
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.s = s
|
||||||
this.x = x
|
this.x = x
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* This is a deprecated class.
|
* This is a deprecated class.
|
||||||
*/
|
*/
|
||||||
Deprecated("do not use")
|
@Deprecated("do not use")
|
||||||
internal class C
|
internal class C
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
Deprecated("do not use")
|
@Deprecated("do not use")
|
||||||
internal class C
|
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'
|
// ERROR: This annotation is not applicable to target 'member property'
|
||||||
internal class A {
|
internal class A {
|
||||||
Deprecated("")
|
@Deprecated("")
|
||||||
Volatile internal var field1 = 0
|
@Volatile internal var field1 = 0
|
||||||
|
|
||||||
Transient internal var field2 = 1
|
@Transient internal var field2 = 1
|
||||||
|
|
||||||
// Should work even for bad modifiers
|
// 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 {
|
object TestClass {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i < 10) {
|
while (i < 10) {
|
||||||
if (i == 4 || i == 8) {
|
if (i == 4 || i == 8) {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object TestClass {
|
object TestClass {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
var i = 0
|
var i = 0
|
||||||
var j = 1
|
var j = 1
|
||||||
while (i < 10) {
|
while (i < 10) {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object TestClass {
|
object TestClass {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
var i = 1
|
var i = 1
|
||||||
while (i < 1000) {
|
while (i < 1000) {
|
||||||
if (i == 4 || i == 8) {
|
if (i == 4 || i == 8) {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object TestClass {
|
object TestClass {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
var i = 1
|
var i = 1
|
||||||
OuterLoop1@ OuterLoop2@ while (i < 1000) {
|
OuterLoop1@ OuterLoop2@ while (i < 1000) {
|
||||||
var j = 1
|
var j = 1
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ internal class Test : Base() {
|
|||||||
return super.equals(o)
|
return super.equals(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
override fun clone(): Any {
|
override fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ internal class Test : Base() {
|
|||||||
return super.toString()
|
return super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(Throwable::class)
|
@Throws(Throwable::class)
|
||||||
override fun finalize() {
|
override fun finalize() {
|
||||||
super.finalize()
|
super.finalize()
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ internal open class Base {
|
|||||||
return super.equals(o)
|
return super.equals(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
protected open fun clone(): Any {
|
protected open fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ internal open class Base {
|
|||||||
return super.toString()
|
return super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(Throwable::class)
|
@Throws(Throwable::class)
|
||||||
protected open fun finalize() {
|
protected open fun finalize() {
|
||||||
super.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 {
|
object A {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// !forceNotNullTypes: false
|
// !forceNotNullTypes: false
|
||||||
object A {
|
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()
|
return super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
protected fun clone(): Any {
|
protected fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Y : Thread() {
|
internal class Y : Thread() {
|
||||||
Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
override fun clone(): Any {
|
override fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ internal class X : Base() {
|
|||||||
return super.toString()
|
return super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(CloneNotSupportedException::class)
|
@Throws(CloneNotSupportedException::class)
|
||||||
protected fun clone(): Any {
|
protected fun clone(): Any {
|
||||||
return super.clone()
|
return super.clone()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
internal class A {
|
internal class A {
|
||||||
Synchronized internal fun foo() {
|
@Synchronized internal fun foo() {
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Throws(IOException::class, SerializationException::class)
|
@Throws(IOException::class, SerializationException::class)
|
||||||
internal fun foo()
|
internal fun foo()
|
||||||
+1
-1
@@ -21,7 +21,7 @@ class Identifier<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object User {
|
object User {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
val i1 = Identifier("name", false, true)
|
val i1 = Identifier("name", false, true)
|
||||||
val i2 = Identifier("name", false)
|
val i2 = Identifier("name", false)
|
||||||
val i3 = Identifier("name")
|
val i3 = Identifier("name")
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
internal object FileRead {
|
internal object FileRead {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
try {
|
try {
|
||||||
val fstream = FileInputStream()
|
val fstream = FileInputStream()
|
||||||
val `in` = DataInputStream(fstream)
|
val `in` = DataInputStream(fstream)
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package demo
|
package demo
|
||||||
|
|
||||||
internal object Program {
|
internal object Program {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
println("Halo!")
|
println("Halo!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import java.lang.reflect.Constructor
|
import java.lang.reflect.Constructor
|
||||||
|
|
||||||
internal object X {
|
internal object X {
|
||||||
Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
internal fun <T> foo(constructor: Constructor<T>, args1: Array<Any>, args2: Array<Any>) {
|
internal fun <T> foo(constructor: Constructor<T>, args1: Array<Any>, args2: Array<Any>) {
|
||||||
constructor.newInstance(*args1)
|
constructor.newInstance(*args1)
|
||||||
constructor.newInstance(args1, args2)
|
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
|
||||||
// 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 {
|
internal class A {
|
||||||
JvmOverloads internal fun foo(s: String? = null): Any {
|
@JvmOverloads internal fun foo(s: String? = null): Any {
|
||||||
println("s = " + s!!)
|
println("s = " + s!!)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ internal class A {
|
|||||||
return bar1(null)
|
return bar1(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
Deprecated("")
|
@Deprecated("")
|
||||||
fun f() {
|
fun f() {
|
||||||
f(1)
|
f(1)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
internal class A {
|
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)
|
println("foo" + i + c + s)
|
||||||
}
|
}
|
||||||
|
|
||||||
JvmOverloads internal fun bar(s: String? = null): Int {
|
@JvmOverloads internal fun bar(s: String? = null): Int {
|
||||||
println("s = " + s!!)
|
println("s = " + s!!)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ internal class A {
|
|||||||
println("p = [$p]")
|
println("p = [$p]")
|
||||||
}
|
}
|
||||||
|
|
||||||
Synchronized fun foo() {
|
@Synchronized fun foo() {
|
||||||
foo(calcSomething())
|
foo(calcSomething())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ object SwitchDemo {
|
|||||||
println(monthString)
|
println(monthString)
|
||||||
}
|
}
|
||||||
|
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
for (i in 1..12)
|
for (i in 1..12)
|
||||||
test(i)
|
test(i)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object NonDefault {
|
object NonDefault {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
|
|
||||||
val value = 3
|
val value = 3
|
||||||
val valueString = ""
|
val valueString = ""
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package switch_demo
|
package switch_demo
|
||||||
|
|
||||||
object SwitchDemo {
|
object SwitchDemo {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
val month = 8
|
val month = 8
|
||||||
val monthString: String
|
val monthString: String
|
||||||
when (month) {
|
when (month) {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object C {
|
object C {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
when (args.size()) {
|
when (args.size()) {
|
||||||
1 -> {
|
1 -> {
|
||||||
run {
|
run {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package switch_demo
|
package switch_demo
|
||||||
|
|
||||||
object SwitchDemo {
|
object SwitchDemo {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
|
|
||||||
val month = 8
|
val month = 8
|
||||||
val monthString: String
|
val monthString: String
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
object NonDefault {
|
object NonDefault {
|
||||||
JvmStatic fun main(args: Array<String>) {
|
@JvmStatic fun main(args: Array<String>) {
|
||||||
|
|
||||||
val value = 3
|
val value = 3
|
||||||
var valueString = ""
|
var valueString = ""
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo() {
|
internal fun foo() {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||||
// reading something
|
// reading something
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo() {
|
internal fun foo() {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { input ->
|
ByteArrayInputStream(ByteArray(10)).use { input ->
|
||||||
ByteArrayOutputStream().use { output ->
|
ByteArrayOutputStream().use { output ->
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo() {
|
internal fun foo() {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { stream -> println(stream.read()) }
|
ByteArrayInputStream(ByteArray(10)).use { stream -> println(stream.read()) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo() {
|
internal fun foo() {
|
||||||
try {
|
try {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
internal interface I {
|
internal interface I {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun doIt(stream: InputStream): Int
|
fun doIt(stream: InputStream): Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo() {
|
internal fun foo() {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||||
bar(object : I {
|
bar(object : I {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun doIt(stream: InputStream): Int {
|
override fun doIt(stream: InputStream): Int {
|
||||||
return stream.available()
|
return stream.available()
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ class C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun bar(i: I, stream: InputStream): Int {
|
internal fun bar(i: I, stream: InputStream): Int {
|
||||||
return i.doIt(stream)
|
return i.doIt(stream)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
internal interface I {
|
internal interface I {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun doIt(stream: InputStream): Int
|
fun doIt(stream: InputStream): Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun foo(): Int {
|
internal fun foo(): Int {
|
||||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||||
return bar(object : I {
|
return bar(object : I {
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun doIt(stream: InputStream): Int {
|
override fun doIt(stream: InputStream): Int {
|
||||||
return stream.available()
|
return stream.available()
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ class C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun bar(i: I, stream: InputStream): Int {
|
internal fun bar(i: I, stream: InputStream): Int {
|
||||||
return i.doIt(stream)
|
return i.doIt(stream)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user