diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.java deleted file mode 100644 index 3faefb8a3f9..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - String[] value() default {"d1", "d2"}; -} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.kt index 91e6ab264ee..c49c9c9a957 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.kt @@ -1,3 +1,15 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + String[] value() default {"d1", "d2"}; +} + +// FILE: 1.kt + @JavaAnn class MyClass1 @JavaAnn() class MyClass2 @JavaAnn("asd") class MyClass3 diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.java deleted file mode 100644 index 59408340bcb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - String[] value(); -} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.kt index b18ecef55cf..2898dd7899d 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.kt @@ -1,3 +1,15 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + String[] value(); +} + +// FILE: 1.kt + @JavaAnn class MyClass1 @JavaAnn() class MyClass2 @JavaAnn("asd") class MyClass3 diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.java deleted file mode 100644 index 7a6c8fbb6cb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - String value(); -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.kt index 381d1f183d4..2e7c21c61b0 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.kt @@ -1,3 +1,15 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + String value(); +} + +// FILE: 1.kt + @JavaAnn("value") class MyClass fun box(): String { diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.java deleted file mode 100644 index 0aff2bc869a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.java +++ /dev/null @@ -1,18 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - String value() default "default"; -} - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn2 { - int a() default 1; - byte b() default 1; - short c() default 1; - double d() default 1; - float e() default 1; - long j() default 1; - String f() default "default"; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.kt index 9acace8116e..4c830fae9dc 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.kt @@ -1,3 +1,31 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + String value() default "default"; +} + +// FILE: JavaAnn2.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn2 { + int a() default 1; + byte b() default 1; + short c() default 1; + double d() default 1; + float e() default 1; + long j() default 1; + String f() default "default"; +} + +// FILE: 1.kt + @JavaAnn class MyClass @JavaAnn2 class MyClass2 diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.java deleted file mode 100644 index bf4066634b1..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.java +++ /dev/null @@ -1,8 +0,0 @@ -class Foo { - public static final int i = -2; - public static final short s = -2; - public static final float f = -2f; - public static final double d = -2.0; - public static final long l = -2L; - public static final byte b = -2; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt index 84efda39e34..4d79826dbe1 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt @@ -1,3 +1,16 @@ +// FILE: Foo.java + +class Foo { + public static final int i = -2; + public static final short s = -2; + public static final float f = -2f; + public static final double d = -2.0; + public static final long l = -2L; + public static final byte b = -2; +} + +// FILE: 1.kt + @Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b) class MyClass fun box(): String { @@ -20,4 +33,4 @@ annotation class Ann( val d: Double, val l: Long, val b: Byte -) \ No newline at end of file +) diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.java deleted file mode 100644 index 2c5840ad27f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.java +++ /dev/null @@ -1,13 +0,0 @@ -class Foo { - public static final int i = 2; - public static final short s = 2; - public static final float f = 2f; - public static final double d = 2.0; - public static final long l = 2L; - public static final byte b = 2; - public static final boolean bool = true; - public static final char c = 'c'; - public static final String str = "str"; - public static final int charAsInt = '3'; - public static final char intAsChar = 3; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt index a9b69dda960..e41bdd0eb65 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt @@ -1,8 +1,26 @@ +// FILE: Foo.java + +class Foo { + public static final int i = 2; + public static final short s = 2; + public static final float f = 2f; + public static final double d = 2.0; + public static final long l = 2L; + public static final byte b = 2; + public static final boolean bool = true; + public static final char c = 'c'; + public static final String str = "str"; + public static final int charAsInt = '3'; + public static final char intAsChar = 3; +} + +// FILE: 1.kt + @Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str, Foo.charAsInt, Foo.intAsChar) class MyClass fun box(): String { val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann == null) return "fail: cannot find Ann on MyClass" if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" @@ -30,4 +48,4 @@ annotation class Ann( val str: String, val i2: Int, val c2: Char -) \ No newline at end of file +) diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.java b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.java deleted file mode 100644 index 3a871981c18..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.java +++ /dev/null @@ -1,9 +0,0 @@ -class Foo { - public static final int i = 2; - public static final short s = 2; - public static final float f = 2; - public static final double d = 2; - public static final long l = 2; - public static final byte b = 2; - public static final char c = 99; -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt index d94d7685b0d..4e6b80d2c6c 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt @@ -1,8 +1,22 @@ +// FILE: Foo.java + +class Foo { + public static final int i = 2; + public static final short s = 2; + public static final float f = 2; + public static final double d = 2; + public static final long l = 2; + public static final byte b = 2; + public static final char c = 99; +} + +// FILE: 1.kt + @Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.c) class MyClass fun box(): String { val ann = MyClass::class.java.getAnnotation(Ann::class.java) - if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann == null) return "fail: cannot find Ann on MyClass" if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" @@ -22,4 +36,4 @@ annotation class Ann( val l: Long, val b: Byte, val c: Char -) \ No newline at end of file +) diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.java deleted file mode 100644 index c3797f1384a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class[] args(); -} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.kt index 3b0de8bcc2f..9093b69cd6f 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.kt @@ -1,3 +1,15 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class[] args(); +} + +// FILE: 1.kt + class O class K diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.java deleted file mode 100644 index 9693d6169ba..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class[] args(); -} - -class O {} -class K {} - -@JavaAnn(args = {O.class, K.class}) -class MyJavaClass {} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt index bca4d131c5f..3b4c2a6b4b4 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt @@ -1,3 +1,23 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class[] args(); +} + +// FILE: MyJavaClass.java + +class O {} +class K {} + +@JavaAnn(args = {O.class, K.class}) +class MyJavaClass {} + +// FILE: 1.kt + fun box(): String { val args = MyJavaClass::class.java.getAnnotation(JavaAnn::class.java).args val argName1 = args[0].simpleName ?: "fail 1" diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.java deleted file mode 100644 index 3f7f8278f8e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class value(); -} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.kt index 43905e6143e..d5abeebc511 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.kt @@ -1,3 +1,14 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class value(); +} + +// FILE: 1.kt class OK diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.java deleted file mode 100644 index 8d7770fd04a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.java +++ /dev/null @@ -1,12 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class value(); -} - -class OK {} - -@JavaAnn(OK.class) -class MyJavaClass {} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.kt index 2536247b788..23b33742207 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.kt @@ -1,3 +1,21 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class value(); +} + +// FILE: MyJavaClass.java + +class OK {} + +@JavaAnn(OK.class) +class MyJavaClass {} + +// FILE: 1.kt fun box(): String { val ann = MyJavaClass::class.java.getAnnotation(JavaAnn::class.java) diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.java deleted file mode 100644 index f17a3c2e606..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class[] value(); -} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.kt index ef9dbffbafd..b26ed81201b 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.kt @@ -1,3 +1,15 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class[] value(); +} + +// FILE: 1.kt + class O class K diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.java b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.java deleted file mode 100644 index fd0b2588516..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -@interface JavaAnn { - Class[] value(); -} - -class O {} -class K {} - -@JavaAnn({O.class, K.class}) -class MyJavaClass {} diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.kt b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.kt index 011fc4edd61..0e8abfcdb72 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.kt @@ -1,3 +1,23 @@ +// FILE: JavaAnn.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +@interface JavaAnn { + Class[] value(); +} + +class O {} +class K {} + +// FILE: MyJavaClass.java + +@JavaAnn({O.class, K.class}) +class MyJavaClass {} + +// FILE: 1.kt + class O class K diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.java b/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.java deleted file mode 100644 index d8eaa2f2ad5..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.java +++ /dev/null @@ -1,6 +0,0 @@ -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.CLASS) -@interface Foo { -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.kt b/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.kt index b2599185872..468f6e457ad 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.kt @@ -1,8 +1,17 @@ -import java.lang.annotation.* +// FILE: Foo.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.CLASS) +@interface Foo { +} + +// FILE: 1.kt @Foo class Bar fun box(): String { Bar() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.java b/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.java deleted file mode 100644 index 143279ed675..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.java +++ /dev/null @@ -1,3 +0,0 @@ -class A { - public A(double x, int y) { } -} diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.kt b/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.kt index 2f592ad1284..a2c3ad8ba04 100644 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/callableReference/constructor.kt @@ -1,3 +1,11 @@ +// FILE: A.java + +class A { + public A(double x, int y) { } +} + +// FILE: 1.kt + fun box(): String { (::A)(0.0, 0) return "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.java b/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.java deleted file mode 100644 index 48056198e02..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.java +++ /dev/null @@ -1,3 +0,0 @@ -public class publicFinalField { - public final String field = "OK"; -} diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.kt b/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.kt index 7cc41f66006..e6eb43158b5 100644 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.kt +++ b/compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.kt @@ -1 +1,9 @@ -fun box() = (publicFinalField::field).get(publicFinalField()) +// FILE: A.java + +public class A { + public final String field = "OK"; +} + +// FILE: 1.kt + +fun box() = (A::field).get(A()) diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.java b/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.java deleted file mode 100644 index b675de28fdb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.java +++ /dev/null @@ -1,3 +0,0 @@ -public class publicMutableField { - public int field = 239; -} diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.kt b/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.kt index 6958866e54a..84cbe7f31ec 100644 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.kt +++ b/compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.kt @@ -1,4 +1,10 @@ -import publicMutableField as A +// FILE: A.java + +public class A { + public int field = 239; +} + +// FILE: 1.kt fun box(): String { val a = A() diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.java b/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.java deleted file mode 100644 index 9a46c3df9c2..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.java +++ /dev/null @@ -1,5 +0,0 @@ -class A { - public static void main(String[] args) { - args[0] = "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.kt b/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.kt index 1820b2123cc..c0a0f9f7441 100644 --- a/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.kt +++ b/compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.kt @@ -1,3 +1,13 @@ +// FILE: A.java + +class A { + public static void main(String[] args) { + args[0] = "OK"; + } +} + +// FILE: 1.kt + fun box(): String { val args = arrayOf("Fail") (A::main)(args) diff --git a/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.java b/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.java deleted file mode 100644 index c4db6c4dddf..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.java +++ /dev/null @@ -1,5 +0,0 @@ -package test; - -public class genericConstructor { - public genericConstructor(T number) {} -} diff --git a/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.kt b/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.kt index 4949e35de93..5af082234f9 100644 --- a/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.kt @@ -1,6 +1,16 @@ -import test.genericConstructor +// FILE: test/Foo.java -class Subclass : genericConstructor(42) { +package test; + +public class Foo { + public Foo(T number) {} +} + +// FILE: 1.kt + +import test.Foo + +class Subclass : Foo(42) { } fun box(): String { diff --git a/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.java b/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.java deleted file mode 100644 index 3d2afa074a1..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.java +++ /dev/null @@ -1,24 +0,0 @@ -package test; - -public class secondaryConstructor { - private final String x; - private final String y; - - public secondaryConstructor(String x, String y) { - this.x = x; - this.y = y; - } - - public secondaryConstructor(String x) { - this(x, "def_y"); - } - - public secondaryConstructor() { - this("def_x"); - } - - @Override - public String toString() { - return x + "#" + y; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.kt b/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.kt index 2dbb0ea6393..ee42097bdfa 100644 --- a/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.kt @@ -1,6 +1,35 @@ -import test.secondaryConstructor; +// FILE: test/Foo.java -class Child : secondaryConstructor { +package test; + +public class Foo { + private final String x; + private final String y; + + public Foo(String x, String y) { + this.x = x; + this.y = y; + } + + public Foo(String x) { + this(x, "def_y"); + } + + public Foo() { + this("def_x"); + } + + @Override + public String toString() { + return x + "#" + y; + } +} + +// FILE: 1.kt + +import test.Foo; + +class Child : Foo { constructor(): super() {} constructor(x: String): super(x) {} constructor(x: String, y: String): super(x, y) {} diff --git a/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.java b/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.java deleted file mode 100644 index ddb9ff115d0..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.Set; - -public class delegationAndInheritanceFromJava { - public interface A extends Set {} - - public interface B extends Set {} -} diff --git a/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.kt b/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.kt index 6692a78a01d..c7ad8ef7092 100644 --- a/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.kt +++ b/compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.kt @@ -1,4 +1,16 @@ -import delegationAndInheritanceFromJava.* +// FILE: Foo.java + +import java.util.Set; + +public class Foo { + public interface A extends Set {} + + public interface B extends Set {} +} + +// FILE: 1.kt + +import Foo.* import java.util.HashSet class Impl(b: B): A, B by b diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.java b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.java deleted file mode 100644 index e557ba4f84d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.java +++ /dev/null @@ -1,5 +0,0 @@ -package test; - -public enum simpleJavaEnum { - A; -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt index eabb6fa33db..fb36a5d4ffb 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt @@ -1,5 +1,15 @@ +// FILE: test/En.java + +package test; + +public enum En { + A; +} + +// FILE: 1.kt + import test.* fun box() = - if (simpleJavaEnum.A.toString() == "A") "OK" + if (En.A.toString() == "A") "OK" else "fail" diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.java b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.java deleted file mode 100644 index 66ca4abe83b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.java +++ /dev/null @@ -1,18 +0,0 @@ -package test; - -import java.lang.Override; -import java.lang.String; - -public enum simpleJavaEnumWithFunction { - A { - @Override - public String repr() { - return "A"; - } - }, - B; - - public String repr() { - return "ololol" + toString(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.kt b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.kt index b74dd20419f..70ebefa67a0 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.kt @@ -1,4 +1,27 @@ -import test.simpleJavaEnumWithFunction.* +// FILE: test/En.java + +package test; + +import java.lang.Override; +import java.lang.String; + +public enum En { + A { + @Override + public String repr() { + return "A"; + } + }, + B; + + public String repr() { + return "ololol" + toString(); + } +} + +// FILE: 1.kt + +import test.En.* fun box() = if (A.repr() == "A" && B.repr() == "olololB") "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.java b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.java deleted file mode 100644 index 47c5ac43a7d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.java +++ /dev/null @@ -1,5 +0,0 @@ -package test; - -public enum simpleJavaEnumWithStaticImport { - A; -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.kt b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.kt index 265d10f9263..9f46b9144b1 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.kt @@ -1,4 +1,14 @@ -import test.simpleJavaEnumWithStaticImport.A +// FILE: test/En.java + +package test; + +public enum En { + A; +} + +// FILE: 1.kt + +import test.En.A fun box() = if (A.toString() == "A") "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.java b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.java deleted file mode 100644 index a5faa7d742a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.java +++ /dev/null @@ -1,7 +0,0 @@ -package test; - -public class simpleJavaInnerEnum { - public enum MyEnum { - A; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.kt b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.kt index d667687f936..cea70111e9d 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.kt @@ -1,6 +1,18 @@ +// FILE: test/Foo.java + +package test; + +public class Foo { + public enum MyEnum { + A; + } +} + +// FILE: 1.kt + import test.* -import test.simpleJavaInnerEnum.MyEnum.A +import test.Foo.MyEnum.A fun box() = - if (simpleJavaInnerEnum.MyEnum.A.toString() == "A" && A.toString() == "A") "OK" + if (Foo.MyEnum.A.toString() == "A" && A.toString() == "A") "OK" else "fail" diff --git a/compiler/testData/codegen/boxAgainstJava/enum/staticField.java b/compiler/testData/codegen/boxAgainstJava/enum/staticField.java deleted file mode 100644 index b54f56ea025..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/staticField.java +++ /dev/null @@ -1,12 +0,0 @@ -package test; - -import java.util.Set; -import java.util.EnumSet; - -public enum staticField { - INSTANCE; - - public static int foo = 42; - - public static final Set INSTANCES = EnumSet.of(INSTANCE); -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/staticField.kt b/compiler/testData/codegen/boxAgainstJava/enum/staticField.kt index bbeae14aa7b..f268c881ea1 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/staticField.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/staticField.kt @@ -1,4 +1,21 @@ -import test.staticField as E +// FILE: test/E.java + +package test; + +import java.util.Set; +import java.util.EnumSet; + +public enum E { + INSTANCE; + + public static int foo = 42; + + public static final Set INSTANCES = EnumSet.of(INSTANCE); +} + +// FILE: 1.kt + +import test.E fun box(): String { val instances = E.INSTANCES diff --git a/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.java b/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.java deleted file mode 100644 index f6d138dadc6..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.java +++ /dev/null @@ -1,9 +0,0 @@ -package test; - -public enum staticMethod { - ENTRY; - - public static String foo() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.kt b/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.kt index bdb6abfcc0d..1cdbae06d5a 100644 --- a/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.kt +++ b/compiler/testData/codegen/boxAgainstJava/enum/staticMethod.kt @@ -1 +1,15 @@ -fun box() = test.staticMethod.foo() +// FILE: test/En.java + +package test; + +public enum En { + ENTRY; + + public static String foo() { + return "OK"; + } +} + +// FILE: 1.kt + +fun box() = test.En.foo() diff --git a/compiler/testData/codegen/boxAgainstJava/functions/constructor.java b/compiler/testData/codegen/boxAgainstJava/functions/constructor.java deleted file mode 100644 index ec67d65e061..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/functions/constructor.java +++ /dev/null @@ -1,7 +0,0 @@ -class A { - public A() {} - - public A(String x) {} - - public A(long l, double z) {} -} diff --git a/compiler/testData/codegen/boxAgainstJava/functions/constructor.kt b/compiler/testData/codegen/boxAgainstJava/functions/constructor.kt index 73e131eb60a..a2f765ecfbd 100644 --- a/compiler/testData/codegen/boxAgainstJava/functions/constructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/functions/constructor.kt @@ -1,3 +1,15 @@ +// FILE: A.java + +class A { + public A() {} + + public A(String x) {} + + public A(long l, double z) {} +} + +// FILE: 1.kt + fun box(): String { A() A("") diff --git a/compiler/testData/codegen/boxAgainstJava/functions/max.java b/compiler/testData/codegen/boxAgainstJava/functions/max.java deleted file mode 100644 index aa9bb7bfe98..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/functions/max.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.*; - -public class max { - public static > T max(Collection coll) { - return Collections.max(coll); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/functions/max.kt b/compiler/testData/codegen/boxAgainstJava/functions/max.kt index 1b701b3a9d3..060d016d024 100644 --- a/compiler/testData/codegen/boxAgainstJava/functions/max.kt +++ b/compiler/testData/codegen/boxAgainstJava/functions/max.kt @@ -1,3 +1,15 @@ -fun box(): String { - return max.max(java.util.Arrays.asList("AK", "OK", "EK"))!! +// FILE: Foo.java + +import java.util.*; + +public class Foo { + public static > T max(Collection coll) { + return Collections.max(coll); + } +} + +// FILE: 1.kt + +fun box(): String { + return Foo.max(java.util.Arrays.asList("AK", "OK", "EK"))!! } diff --git a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.java b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.java deleted file mode 100644 index 13e35103696..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.java +++ /dev/null @@ -1,5 +0,0 @@ -class R { - public static class id { - public static final int main = 17; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.kt b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.kt index ff96695b7cf..7d45a7f330d 100644 --- a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.kt +++ b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.kt @@ -1,2 +1,12 @@ +// FILE: R.java + +class R { + public static class id { + public static final int main = 17; + } +} + +// FILE: 1.kt + fun box() = if (R.id.main == 17) "OK" else "fail" diff --git a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.java b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.java deleted file mode 100644 index 4ccb93887ab..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.java +++ /dev/null @@ -1,7 +0,0 @@ -class R { - public static class id { - public static class zzz { - public static final int main = 17; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.kt b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.kt index dfd0c4f6603..dff232e2b65 100644 --- a/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.kt +++ b/compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.kt @@ -1,2 +1,14 @@ +// FILE: R.java + +class R { + public static class id { + public static class zzz { + public static final int main = 17; + } + } +} + +// FILE: 1.kt + fun box() = if (R.id.zzz.main == 17) "OK" else "fail" diff --git a/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.java b/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.java deleted file mode 100644 index ef6bbe40827..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.Collection; - -public class unrelatedUpperBounds { - public static T id(T p) { - return p; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.kt b/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.kt index e7d0d2f1b10..c3658604778 100644 --- a/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.kt +++ b/compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.kt @@ -1,3 +1,15 @@ -fun box(): String { - return unrelatedUpperBounds.id("OK" as java.lang.String)!! as kotlin.String +// FILE: Foo.java + +import java.util.Collection; + +public class Foo { + public static T id(T p) { + return p; + } +} + +// FILE: 1.kt + +fun box(): String { + return Foo.id("OK" as java.lang.String)!! as kotlin.String } diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.java b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.java deleted file mode 100644 index 590f92dbf37..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.java +++ /dev/null @@ -1,3 +0,0 @@ -public class kt3532 { - public class Inner { } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.kt b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.kt index c935a7b7e93..7a6bebd14f4 100644 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.kt +++ b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.kt @@ -1,4 +1,12 @@ +// FILE: Foo.java + +public class Foo { + public class Inner { } +} + +// FILE: 1.kt + fun box(): String { - kt3532().Inner() + Foo().Inner() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.java b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.java deleted file mode 100644 index b32580da767..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.java +++ /dev/null @@ -1,8 +0,0 @@ -public class kt3812 { - public class Inner { - - } - - public class Inner$ { - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.kt b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.kt index 53ee54da303..b8672663202 100644 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.kt +++ b/compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.kt @@ -1,5 +1,18 @@ +// FILE: Foo.java + +public class Foo { + public class Inner { + + } + + public class Inner$ { + } +} + +// FILE: 1.kt + fun box(): String { - kt3812().Inner() - kt3812().`Inner$`() + Foo().Inner() + Foo().`Inner$`() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.java b/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.java deleted file mode 100644 index e37f746cf81..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.java +++ /dev/null @@ -1,8 +0,0 @@ -public class kt4036 { - public class Inner1$class { - - } - - public class Inner2$class { - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.kt b/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.kt index ad4612e56ba..b44cebe6b9d 100644 --- a/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.kt +++ b/compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.kt @@ -1,5 +1,17 @@ +// FILE: Foo.java + +public class Foo { + public class Inner1$class { + } + + public class Inner2$class { + } +} + +// FILE: 1.kt + fun box(): String { - kt4036().`Inner1$class`() - kt4036().`Inner2$class`() + Foo().`Inner1$class`() + Foo().`Inner2$class`() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.java b/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.java deleted file mode 100644 index 0e732047214..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.java +++ /dev/null @@ -1,3 +0,0 @@ -interface A { - void foo(); -} diff --git a/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.kt b/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.kt index cb5bd7c53bf..e42a28174d3 100644 --- a/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.kt +++ b/compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.kt @@ -1,3 +1,11 @@ +// FILE: A.java + +interface A { + void foo(); +} + +// FILE: 1.kt + internal interface B : A { fun bar() = 1 } diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.java b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.java deleted file mode 100644 index d6ce0b6c4bb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.java +++ /dev/null @@ -1,7 +0,0 @@ -public class Delegation { - public static class ReturnNull { - public String foo() { - return null; - } - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.java b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.java deleted file mode 100644 index 226c959529f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.java +++ /dev/null @@ -1,5 +0,0 @@ -class RightElvisOperand { - static String foo() { - return null; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt similarity index 69% rename from compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.kt rename to compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt index bd019bf5a43..168bec14d42 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt @@ -1,3 +1,15 @@ +// FILE: Delegation.java + +public class Delegation { + public static class ReturnNull { + public String foo() { + return null; + } + } +} + +// FILE: 1.kt + interface Tr { fun foo(): String } @@ -18,4 +30,4 @@ fun box(): String { println(e.message) return "OK" } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt similarity index 78% rename from compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.kt rename to compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt index 39530d56335..6e49194ed76 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt @@ -1,3 +1,13 @@ +// FILE: RightElvisOperand.java + +class RightElvisOperand { + static String foo() { + return null; + } +} + +// FILE: 1.kt + fun baz(): String? = null fun bar(): String = baz() ?: RightElvisOperand.foo() diff --git a/compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.java b/compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.java deleted file mode 100644 index 76e01c52779..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.java +++ /dev/null @@ -1,11 +0,0 @@ -public class GenericUnit { - public static class Key {} - - public static T getNull(Key key) { - return null; - } - - public static T get(Key key, T t) { - return t; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.kt b/compiler/testData/codegen/boxAgainstJava/platformTypes/genericUnit.kt similarity index 55% rename from compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.kt rename to compiler/testData/codegen/boxAgainstJava/platformTypes/genericUnit.kt index ca3e3a6dfd6..092582f1f91 100644 --- a/compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.kt +++ b/compiler/testData/codegen/boxAgainstJava/platformTypes/genericUnit.kt @@ -1,4 +1,20 @@ -import GenericUnit.* +// FILE: Foo.java + +public class Foo { + public static class Key {} + + public static T getNull(Key key) { + return null; + } + + public static T get(Key key, T t) { + return t; + } +} + +// FILE: 1.kt + +import Foo.* val key = Key() @@ -14,4 +30,4 @@ fun box(): String { if (n3 != Unit) return "Fail 3.1: $n3" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.java b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.java deleted file mode 100644 index 47a73954c47..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.java +++ /dev/null @@ -1,3 +0,0 @@ -public class fieldAccessFromExtensionInTraitImpl { - public final String result = "OK"; -} diff --git a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.kt b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.kt index 9b423f9a325..6b16c4c6faf 100644 --- a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.kt +++ b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.kt @@ -1,6 +1,12 @@ -// KT-4878 +// FILE: D.java -import fieldAccessFromExtensionInTraitImpl as D +public class D { + public final String result = "OK"; +} + +// FILE: 1.kt + +// KT-4878 interface T { fun Int.foo(d: D) = d.result!! diff --git a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.java b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.java deleted file mode 100644 index 9000607dc76..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class fieldAccessViaSubclass { - public String fieldO; - - public static String fieldK; -} diff --git a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.kt b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.kt index dcdd42591af..6e84f669dad 100644 --- a/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.kt +++ b/compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.kt @@ -1,12 +1,21 @@ +// FILE: D.java + +public class D { + public String fieldO; + + public static String fieldK; +} + +// FILE: 1.kt + // KT-3492 -class MyWrongClass : fieldAccessViaSubclass() { - +class MyWrongClass : D() { } fun box() : String { - val clazz = MyWrongClass() - clazz.fieldO = "O" - fieldAccessViaSubclass.fieldK = "K" - return clazz.fieldO!! + fieldAccessViaSubclass.fieldK!! + val clazz = MyWrongClass() + clazz.fieldO = "O" + D.fieldK = "K" + return clazz.fieldO!! + D.fieldK!! } diff --git a/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.java b/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.java deleted file mode 100644 index e03fdfc153f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.java +++ /dev/null @@ -1,7 +0,0 @@ -package test; - -public class referenceToJavaFieldViaBridge { - - protected String field = "OK"; - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.kt b/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.kt index 98738e7f0ee..56dea581110 100644 --- a/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.kt +++ b/compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.kt @@ -1,8 +1,16 @@ +// FILE: test/D.java -import test.referenceToJavaFieldViaBridge +package test; -class A : referenceToJavaFieldViaBridge() { +public class D { + protected String field = "OK"; +} +// FILE: 1.kt + +import test.D + +class A : D() { fun a(): String { return {field!!}() } @@ -10,4 +18,4 @@ class A : referenceToJavaFieldViaBridge() { fun box(): String { return A().a() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.java b/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.java deleted file mode 100644 index e553ede479a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.java +++ /dev/null @@ -1,2 +0,0 @@ -public class javaClassLiteral { -} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.kt b/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.kt index dceaecb4de3..ab0a844ab03 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.kt @@ -1,8 +1,13 @@ -import javaClassLiteral as J +// FILE: J.java + +public class J { +} + +// FILE: 1.kt fun box(): String { val j = J::class - if (j.simpleName != "javaClassLiteral") return "Fail: ${j.simpleName}" + if (j.simpleName != "J") return "Fail: ${j.simpleName}" return "OK" } diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.java b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.java deleted file mode 100644 index 0256b2f75f7..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.java +++ /dev/null @@ -1 +0,0 @@ -public class jClass2kClass {} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.kt b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.kt index 290406666b1..6927482e66e 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.kt @@ -1,4 +1,8 @@ -import jClass2kClass as J +// FILE: J.java + +public class J {} + +// FILE: 1.kt import kotlin.reflect.jvm.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.java b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.java deleted file mode 100644 index 72e8632823e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.java +++ /dev/null @@ -1,7 +0,0 @@ -public class javaConstructor { - public final String result; - - public javaConstructor(String result) { - this.result = result; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.kt b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.kt index 17edc8625ca..46e3a2e46e0 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.kt @@ -1,6 +1,17 @@ +// FILE: J.java + +public class J { + public final String result; + + public J(String result) { + this.result = result; + } +} + +// FILE: 1.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* -import javaConstructor as J fun box(): String { val reference = ::J diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.java b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.java deleted file mode 100644 index 0377951bd4b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.java +++ /dev/null @@ -1,9 +0,0 @@ -public class javaFields { - public final int i; - public String s; - - public javaFields(int i, String s) { - this.i = i; - this.s = s; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.kt b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.kt index ddf6ac098e1..d199d771f33 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.kt @@ -1,5 +1,17 @@ +// FILE: J.java + +public class J { + public final int i; + public String s; + + public J(int i, String s) { + this.i = i; + this.s = s; + } +} + +// FILE: 1.kt // FULL_JDK -import javaFields as J import java.lang.reflect.* import kotlin.reflect.* diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.java b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.java deleted file mode 100644 index a1a6dd5380d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.java +++ /dev/null @@ -1,9 +0,0 @@ -public class javaMethods { - public String f(String s) { - return s; - } - - public static String g(String s) { - return s; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.kt b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.kt index c03578eb4ca..6ddce141287 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.kt @@ -1,6 +1,19 @@ +// FILE: J.java + +public class J { + public String f(String s) { + return s; + } + + public static String g(String s) { + return s; + } +} + +// FILE: 1.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* -import javaMethods as J fun box(): String { val f = J::f diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.java b/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.java deleted file mode 100644 index 82d5b58a933..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.java +++ /dev/null @@ -1,11 +0,0 @@ -package test; - -public class equalsHashCodeToString { - public final boolean b; - public char c; - - public equalsHashCodeToString() { - this.b = false; - this.c = '0'; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.kt b/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.kt index 803e585fe7e..edcb01036f0 100644 --- a/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.kt +++ b/compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.kt @@ -1,11 +1,26 @@ +// FILE: test/J.java + +package test; + +public class J { + public final boolean b; + public char c; + + public J() { + this.b = false; + this.c = '0'; + } +} + +// FILE: 1.kt + package test import kotlin.test.* -import test.equalsHashCodeToString as J fun box(): String { - assertEquals("val test.equalsHashCodeToString.b: kotlin.Boolean", (J::b).toString()) - assertEquals("var test.equalsHashCodeToString.c: kotlin.Char", (J::c).toString()) + assertEquals("val test.J.b: kotlin.Boolean", (J::b).toString()) + assertEquals("var test.J.c: kotlin.Char", (J::c).toString()) assertTrue(J::b == J::b) assertFalse(J::c == J::b) diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.java deleted file mode 100644 index 9cbd1d040bb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.java +++ /dev/null @@ -1,19 +0,0 @@ -class JavaClass { - public interface Super1 { - Thread call(T t); - } - - public interface Super2 { - T call(String s); - } - - public interface Sub extends Super1, Super2 { - Thread call(String s); - } - - static void samAdapter(Sub sub) { - ((Super1) sub).call(""); - ((Super2) sub).call(""); - sub.call(""); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.kt index 0c595206399..d19569ddc10 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.kt @@ -1,3 +1,27 @@ +// FILE: JavaClass.java + +class JavaClass { + public interface Super1 { + Thread call(T t); + } + + public interface Super2 { + T call(String s); + } + + public interface Sub extends Super1, Super2 { + Thread call(String s); + } + + static void samAdapter(Sub sub) { + ((Super1) sub).call(""); + ((Super2) sub).call(""); + sub.call(""); + } +} + +// FILE: 1.kt + fun box(): String? { var s: String? s = "FAIL for function literal" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.java deleted file mode 100644 index 79fe82dcb10..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.java +++ /dev/null @@ -1,17 +0,0 @@ -// KT-5912 -class JavaClass { - public static interface Action { - void call(T t); - } - - public static class Some { - public Some(T t) { - } - } - - public static interface OnSubscribe extends Action> {} - - void perform(T t, OnSubscribe subscribe) { - subscribe.call(new Some(t)); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.kt index d77644aa8be..a05139d7960 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.kt @@ -1,3 +1,25 @@ +// FILE: JavaClass.java + +// KT-5912 +class JavaClass { + public static interface Action { + void call(T t); + } + + public static class Some { + public Some(T t) { + } + } + + public static interface OnSubscribe extends Action> {} + + void perform(T t, OnSubscribe subscribe) { + subscribe.call(new Some(t)); + } +} + +// FILE: 1.kt + // KT-5912 fun box(): String { var s = "Failt" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.java deleted file mode 100644 index 52bae414b31..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.java +++ /dev/null @@ -1,3 +0,0 @@ -interface JavaInterface { - void run(Runnable r); -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.kt index c2876a79939..e392c8708c6 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.kt @@ -1,3 +1,11 @@ +// FILE: JavaInterface.java + +interface JavaInterface { + void run(Runnable r); +} + +// FILE: 1.kt + class Impl: JavaInterface { override fun run(r: Runnable?) { r?.run() @@ -8,4 +16,4 @@ fun box(): String { var v = "FAIL" Impl().run { v = "OK" } return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.java deleted file mode 100644 index 1d6843c1a82..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.*; - -class JavaClass { - public static void sortIntList(List list, Comparator comparator) { - Collections.sort(list, comparator); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.kt index 57932c64f29..f039b302190 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.kt @@ -1,3 +1,15 @@ +// FILE: JavaClass.java + +import java.util.*; + +class JavaClass { + public static void sortIntList(List list, Comparator comparator) { + Collections.sort(list, comparator); + } +} + +// FILE: 1.kt + import java.util.* fun box(): String { @@ -5,4 +17,4 @@ fun box(): String { val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1)) JavaClass.sortIntList(list, { a, b -> b - a }) return if (list == expected) "OK" else list.toString() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.java deleted file mode 100644 index c47e8ab052e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private Runnable r; - - public JavaClass(Runnable r) { - this.r = r; - } - - public void run() { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.kt index 15128cc1a13..17b6734a918 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.kt @@ -1,5 +1,21 @@ +// FILE: JavaClass.java + +class JavaClass { + private Runnable r; + + public JavaClass(Runnable r) { + this.r = r; + } + + public void run() { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" JavaClass { v = "OK" }.run() return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.java deleted file mode 100644 index 66fd53063de..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.java +++ /dev/null @@ -1,3 +0,0 @@ -interface GenericInterface { - public T foo(double d, int i, long j, short s); -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.kt index e7ba3cf1107..b873863d384 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.kt @@ -1,3 +1,11 @@ +// FILE: GenericInterface.java + +interface GenericInterface { + public T foo(double d, int i, long j, short s); +} + +// FILE: 1.kt + internal fun getInterface(): GenericInterface { return GenericInterface { d, i, j, s -> "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.java deleted file mode 100644 index b0f6a35b314..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.io.*; - -class JavaClass { - public static String invokeFilter(FileFilter f, File file1, File file2) { - return f.accept(file1) + " " + f.accept(file2); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.kt index 08f4a5d21ff..30316e61a28 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.kt @@ -1,3 +1,15 @@ +// FILE: JavaClass.java + +import java.io.*; + +class JavaClass { + public static String invokeFilter(FileFilter f, File file1, File file2) { + return f.accept(file1) + " " + f.accept(file2); + } +} + +// FILE: 1.kt + import java.io.* fun box(): String { diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.java deleted file mode 100644 index 573a1260ed6..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.java +++ /dev/null @@ -1,8 +0,0 @@ -import java.util.Arrays; -import java.util.Comparator; - -class JavaClass { - public static String foo(Comparator comparator) { - return Arrays.toString(comparator.getClass().getGenericInterfaces()); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.kt index c857a4ac1c4..45d70951104 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.kt @@ -1,3 +1,16 @@ +// FILE: JavaClass.java + +import java.util.Arrays; +import java.util.Comparator; + +class JavaClass { + public static String foo(Comparator comparator) { + return Arrays.toString(comparator.getClass().getGenericInterfaces()); + } +} + +// FILE: 1.kt + fun box(): String { val supertypes = JavaClass.foo { a, b -> a.compareTo(b) } if (supertypes != "[java.util.Comparator]") return "Fail: $supertypes" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.java deleted file mode 100644 index 9961787a66e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.java +++ /dev/null @@ -1,3 +0,0 @@ -interface JavaInterface { - void foo(Runnable r); -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.kt index 9bfe0b66463..3c1d7f9a097 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.kt @@ -1,3 +1,11 @@ +// FILE: JavaInterface.java + +interface JavaInterface { + void foo(Runnable r); +} + +// FILE: 1.kt + class Impl: JavaInterface { override fun foo(r: Runnable?) { r?.run() @@ -9,4 +17,4 @@ fun box(): String { if (fooMethods.size != 1) return fooMethods.toString() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.java deleted file mode 100644 index 770c145ed5a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - public void run(Runnable r) { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.kt index 28cac5f89e0..7f27754b2fd 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +class JavaClass { + public void run(Runnable r) { + r.run(); + } +} + +// FILE: 1.kt + internal class KotlinSubclass: JavaClass() { } @@ -5,4 +15,4 @@ fun box(): String { var v = "FAIL" KotlinSubclass().run { v = "OK" } return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.java deleted file mode 100644 index 4489ca4cf5e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.java +++ /dev/null @@ -1,13 +0,0 @@ -class Super { - public String lastCalled = null; - - void foo(Runnable r) { - lastCalled = "super"; - } -} - -class Sub extends Super { - void foo(kotlin.jvm.functions.Function0 r) { - lastCalled = "sub"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt index 86a9dfa1b8c..3cdac18ad6f 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt @@ -1,3 +1,26 @@ +// FILE: Super.java + +class Super { + public String lastCalled = null; + + void foo(Runnable r) { + lastCalled = "super"; + } +} + +// FILE: Sub.java + +import kotlin.jvm.functions.Function0; +import kotlin.Unit; + +class Sub extends Super { + void foo(Function0 r) { + lastCalled = "sub"; + } +} + +// FILE: 1.kt + fun box(): String { val sub = Sub() val sup: Super = sub diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.java deleted file mode 100644 index a920bc36748..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.java +++ /dev/null @@ -1,8 +0,0 @@ -class Super { - void safeInvoke(Runnable r) { - if (r != null) r.run(); - } -} - -class Sub extends Super { -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.kt index 7cb86b41692..fe0d0d1d8a5 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.kt @@ -1,3 +1,16 @@ +// FILE: Sub.java + +class Super { + void safeInvoke(Runnable r) { + if (r != null) r.run(); + } +} + +class Sub extends Super { +} + +// FILE: 1.kt + fun box(): String { var r = "FAIL" val sub = Sub() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.java deleted file mode 100644 index c47e8ab052e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private Runnable r; - - public JavaClass(Runnable r) { - this.r = r; - } - - public void run() { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.kt index 22920f97b76..ac4f86668b9 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private Runnable r; + + public JavaClass(Runnable r) { + this.r = r; + } + + public void run() { + r.run(); + } +} + +// FILE: 1.kt + var status: String = "fail" // global property to avoid issues with accessing closure from local class (KT-4174) fun box(): String { @@ -5,4 +21,3 @@ fun box(): String { C().run() return status } - diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.java deleted file mode 100644 index c47e8ab052e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private Runnable r; - - public JavaClass(Runnable r) { - this.r = r; - } - - public void run() { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.kt index d704e59c95a..d7436c4ec21 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private Runnable r; + + public JavaClass(Runnable r) { + this.r = r; + } + + public void run() { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val x = object : JavaClass({-> v = "OK"}) {} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.java deleted file mode 100644 index c47e8ab052e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private Runnable r; - - public JavaClass(Runnable r) { - this.r = r; - } - - public void run() { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.kt index 0d434bf48dc..adee29d9fe9 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private Runnable r; + + public JavaClass(Runnable r) { + this.r = r; + } + + public void run() { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val f = {-> v = "OK"} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.java deleted file mode 100644 index b740457a32c..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - public static void run(Runnable r1, Runnable r2) { - r1.run(); - r2.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt index 433f6d04e4b..32205c28768 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt @@ -1,6 +1,17 @@ +// FILE: JavaClass.java + +class JavaClass { + public static void run(Runnable r1, Runnable r2) { + r1.run(); + r2.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val f = { v = "O" } JavaClass.run(f, { v += "K" }) return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.java deleted file mode 100644 index 1d6843c1a82..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.*; - -class JavaClass { - public static void sortIntList(List list, Comparator comparator) { - Collections.sort(list, comparator); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt index 86a484a6590..7ff57f31114 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt @@ -1,3 +1,15 @@ +// FILE: JavaClass.java + +import java.util.*; + +class JavaClass { + public static void sortIntList(List list, Comparator comparator) { + Collections.sort(list, comparator); + } +} + +// FILE: 1.kt + import java.util.* fun box(): String { @@ -7,4 +19,4 @@ fun box(): String { val f = { a: Int, b: Int -> b - a } JavaClass.sortIntList(list, f) return if (list == expected) "OK" else list.toString() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.java deleted file mode 100644 index c47e8ab052e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private Runnable r; - - public JavaClass(Runnable r) { - this.r = r; - } - - public void run() { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.kt index 9d2e9a4f8b7..2d15f8acc86 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.kt @@ -1,6 +1,22 @@ +// FILE: JavaClass.java + +class JavaClass { + private Runnable r; + + public JavaClass(Runnable r) { + this.r = r; + } + + public void run() { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val f = { v = "OK" } JavaClass(f).run() return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.java deleted file mode 100644 index b0391031c83..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - public static String run(Runnable r) { - return r == null ? "OK" : "FAIL"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.kt index d4f6cb328db..3a379f8cbd1 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.kt @@ -1,4 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + public static String run(Runnable r) { + return r == null ? "OK" : "FAIL"; + } +} + +// FILE: 1.kt + fun box(): String { val f: (() -> Unit)? = null return JavaClass.run(f)!! -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.java deleted file mode 100644 index 3860797a795..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - public static void run(Runnable r) { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.kt index 093a7879ce5..c7085e2ef61 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.kt @@ -1,6 +1,16 @@ +// FILE: JavaClass.java + +class JavaClass { + public static void run(Runnable r) { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val f = { v = "OK" } JavaClass.run(f) return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.java deleted file mode 100644 index 7edd703ca7c..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.java +++ /dev/null @@ -1,40 +0,0 @@ -import org.jetbrains.annotations.NotNull; - -class Container { - @NotNull - Value get(Runnable i) { - i.run(); - return new Value(); - } - - void set(Runnable i, @NotNull Value value) { - i.run(); - } -} - -class Value { - @NotNull Value plus(Runnable i) { - i.run(); - return this; - } - - @NotNull Value minus(Runnable i) { - i.run(); - return this; - } - - @NotNull Value times(Runnable i) { - i.run(); - return this; - } - - @NotNull Value div(Runnable i) { - i.run(); - return this; - } - - @NotNull Value mod(Runnable i) { - i.run(); - return this; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.kt index e18299a42b6..1cd790183f7 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.kt @@ -1,30 +1,73 @@ +// FILE: Container.java + +import org.jetbrains.annotations.NotNull; + +class Container { + @NotNull + Value get(Runnable i) { + i.run(); + return new Value(); + } + + void set(Runnable i, @NotNull Value value) { + i.run(); + } +} + +class Value { + @NotNull Value plus(Runnable i) { + i.run(); + return this; + } + + @NotNull Value minus(Runnable i) { + i.run(); + return this; + } + + @NotNull Value times(Runnable i) { + i.run(); + return this; + } + + @NotNull Value div(Runnable i) { + i.run(); + return this; + } + + @NotNull Value mod(Runnable i) { + i.run(); + return this; + } +} + +// FILE: 1.kt + fun box(): String { var c = Container() var indexAccess = 0 - // TODO uncomment when KT-3723 is fixed + var v1 = "FAIL" + c[{ indexAccess++ }] += { v1 = "OK" } + if (v1 != "OK") return "plus: $v1" - //var v1 = "FAIL" - //c[{ indexAccess++ }] += { v1 = "OK" } - //if (v1 != "OK") return "plus: $v1" - // - //var v2 = "FAIL" - //c[{ indexAccess++ }] -= { v2 = "OK" } - //if (v2 != "OK") return "minus: $v2" - // - //var v3 = "FAIL" - //c[{ indexAccess++ }] *= { v3 = "OK" } - //if (v3 != "OK") return "times: $v3" - // - //var v4 = "FAIL" - //c[{ indexAccess++ }] /= { v4 = "OK" } - //if (v4 != "OK") return "div: $v4" - // - //var v5 = "FAIL" - //c[{ indexAccess++ }] %= { v5 = "OK" } - //if (v5 != "OK") return "mod: $v5" - // - //if (indexAccess != 10) return indexAccess + var v2 = "FAIL" + c[{ indexAccess++ }] -= { v2 = "OK" } + if (v2 != "OK") return "minus: $v2" + + var v3 = "FAIL" + c[{ indexAccess++ }] *= { v3 = "OK" } + if (v3 != "OK") return "times: $v3" + + var v4 = "FAIL" + c[{ indexAccess++ }] /= { v4 = "OK" } + if (v4 != "OK") return "div: $v4" + + var v5 = "FAIL" + c[{ indexAccess++ }] %= { v5 = "OK" } + if (v5 != "OK") return "mod: $v5" + + if (indexAccess != 10) return "Fail: $indexAccess" return "OK" } diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.java deleted file mode 100644 index ca769a8b559..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.java +++ /dev/null @@ -1,21 +0,0 @@ -class JavaClass { - void plusAssign(Runnable i) { - i.run(); - } - - void minusAssign(Runnable i) { - i.run(); - } - - void timesAssign(Runnable i) { - i.run(); - } - - void divAssign(Runnable i) { - i.run(); - } - - void modAssign(Runnable i) { - i.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.kt index cabf08c76bd..fdb6b21e192 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.kt @@ -1,3 +1,29 @@ +// FILE: JavaClass.java + +class JavaClass { + void plusAssign(Runnable i) { + i.run(); + } + + void minusAssign(Runnable i) { + i.run(); + } + + void timesAssign(Runnable i) { + i.run(); + } + + void divAssign(Runnable i) { + i.run(); + } + + void modAssign(Runnable i) { + i.run(); + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.java deleted file mode 100644 index 1714cf7cfc8..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.java +++ /dev/null @@ -1,28 +0,0 @@ -import org.jetbrains.annotations.NotNull; - -class JavaClass { - @NotNull JavaClass plus(Runnable i) { - i.run(); - return this; - } - - @NotNull JavaClass minus(Runnable i) { - i.run(); - return this; - } - - @NotNull JavaClass times(Runnable i) { - i.run(); - return this; - } - - @NotNull JavaClass div(Runnable i) { - i.run(); - return this; - } - - @NotNull JavaClass mod(Runnable i) { - i.run(); - return this; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.kt index 037ae0f0510..55e63fe3f52 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.kt @@ -1,3 +1,36 @@ +// FILE: JavaClass.java + +import org.jetbrains.annotations.NotNull; + +class JavaClass { + @NotNull JavaClass plus(Runnable i) { + i.run(); + return this; + } + + @NotNull JavaClass minus(Runnable i) { + i.run(); + return this; + } + + @NotNull JavaClass times(Runnable i) { + i.run(); + return this; + } + + @NotNull JavaClass div(Runnable i) { + i.run(); + return this; + } + + @NotNull JavaClass mod(Runnable i) { + i.run(); + return this; + } +} + +// FILE: 1.kt + fun box(): String { var obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.java deleted file mode 100644 index c15741b0dba..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.java +++ /dev/null @@ -1,31 +0,0 @@ -class JavaClass { - JavaClass plus(Runnable i) { - i.run(); - return this; - } - - JavaClass minus(Runnable i) { - i.run(); - return this; - } - - JavaClass times(Runnable i) { - i.run(); - return this; - } - - JavaClass div(Runnable i) { - i.run(); - return this; - } - - JavaClass mod(Runnable i) { - i.run(); - return this; - } - - JavaClass rangeTo(Runnable i) { - i.run(); - return this; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.kt index 3840de1fd48..ef16834b95a 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.kt @@ -1,3 +1,39 @@ +// FILE: JavaClass.java + +class JavaClass { + JavaClass plus(Runnable i) { + i.run(); + return this; + } + + JavaClass minus(Runnable i) { + i.run(); + return this; + } + + JavaClass times(Runnable i) { + i.run(); + return this; + } + + JavaClass div(Runnable i) { + i.run(); + return this; + } + + JavaClass mod(Runnable i) { + i.run(); + return this; + } + + JavaClass rangeTo(Runnable i) { + i.run(); + return this; + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.java deleted file mode 100644 index 9f7d4bc01c9..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - int compareTo(Runnable i) { - i.run(); - return 239; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.kt index b73c74b1e24..8010a965092 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.kt @@ -1,3 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + int compareTo(Runnable i) { + i.run(); + return 239; + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.java deleted file mode 100644 index 633d1bba79e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - boolean contains(Runnable i) { - i.run(); - return true; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.kt index a42a74b6250..c091691ef1c 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.kt @@ -1,3 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + boolean contains(Runnable i) { + i.run(); + return true; + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.java deleted file mode 100644 index 4cda5428442..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - int get(Runnable i) { - i.run(); - return 239; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.kt index c4bad79f808..a5a2e75de06 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.kt @@ -1,3 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + int get(Runnable i) { + i.run(); + return 239; + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.java deleted file mode 100644 index f5d89291195..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - void invoke(Runnable i) { - i.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt index adddf653b79..dbe29715072 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +class JavaClass { + void invoke(Runnable i) { + i.run(); + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.java deleted file mode 100644 index 75c0ddc46a9..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.java +++ /dev/null @@ -1,13 +0,0 @@ -class JavaClass { - int get(Runnable i1, Runnable i2) { - i1.run(); - i2.run(); - return 239; - } - - void set(Runnable i1, Runnable i2, Runnable value) { - i1.run(); - i2.run(); - value.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt index 74d21d6b861..cfc68e2234d 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt @@ -1,3 +1,21 @@ +// FILE: JavaClass.java + +class JavaClass { + int get(Runnable i1, Runnable i2) { + i1.run(); + i2.run(); + return 239; + } + + void set(Runnable i1, Runnable i2, Runnable value) { + i1.run(); + i2.run(); + value.run(); + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.java deleted file mode 100644 index 89a33b0219c..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - void invoke(Runnable p1, Runnable p2) { - p1.run(); - p2.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.kt index b1bf1a36bfa..57789699b0f 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.kt @@ -1,3 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + void invoke(Runnable p1, Runnable p2) { + p1.run(); + p2.run(); + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.java deleted file mode 100644 index 037f17f3870..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.java +++ /dev/null @@ -1,6 +0,0 @@ -class JavaClass { - void set(Runnable i, Runnable value) { - i.run(); - value.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.kt index ccb81a8cd8f..86fb0a0e1e4 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.kt @@ -1,3 +1,14 @@ +// FILE: JavaClass.java + +class JavaClass { + void set(Runnable i, Runnable value) { + i.run(); + value.run(); + } +} + +// FILE: 1.kt + fun box(): String { val obj = JavaClass() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.java deleted file mode 100644 index 7a4138f5886..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - protected void execute(T t, Runnable r) { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.kt index c99e87020ce..005c322782e 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +class JavaClass { + protected void execute(T t, Runnable r) { + r.run(); + } +} + +// FILE: 1.kt + internal class KotlinClass : JavaClass() { fun doIt(): String { var result = "" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.java deleted file mode 100644 index 34d70ac06bf..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.java +++ /dev/null @@ -1,9 +0,0 @@ -import java.util.*; - -class JavaClass { - public static String findMaxAndInvokeCallback(Comparator comparator, String a, String b, Runnable afterRunnable) { - int compare = comparator.compare(a, b); - afterRunnable.run(); - return compare > 0 ? a : b; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.kt index 840410471fa..b56b1b6e332 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.kt @@ -1,3 +1,17 @@ +// FILE: JavaClass.java + +import java.util.*; + +class JavaClass { + public static String findMaxAndInvokeCallback(Comparator comparator, String a, String b, Runnable afterRunnable) { + int compare = comparator.compare(a, b); + afterRunnable.run(); + return compare > 0 ? a : b; + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" val max = JavaClass.findMaxAndInvokeCallback({ a, b -> a.length - b.length }, "foo", "kotlin", { v = "OK" }) diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.java deleted file mode 100644 index 3860797a795..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - public static void run(Runnable r) { - r.run(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.kt index d0b28745431..31c251d821c 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.kt @@ -1,5 +1,15 @@ +// FILE: JavaClass.java + +class JavaClass { + public static void run(Runnable r) { + r.run(); + } +} + +// FILE: 1.kt + fun box(): String { var v = "FAIL" JavaClass.run { v = "OK" } return v -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.java deleted file mode 100644 index 2107dda85a7..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - JavaClass(Runnable r) { - if (r != null) r.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.kt index 4e339c15303..3acda61b1bb 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +class JavaClass { + JavaClass(Runnable r) { + if (r != null) r.run(); + } +} + +// FILE: 1.kt + internal class KotlinClass(): JavaClass(null) { } diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.java deleted file mode 100644 index 2107dda85a7..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaClass { - JavaClass(Runnable r) { - if (r != null) r.run(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.kt index 853a4b842e8..e0624e72936 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +class JavaClass { + JavaClass(Runnable r) { + if (r != null) r.run(); + } +} + +// FILE: 1.kt + var status: String = "fail" // global property to avoid issues with accessing closure from local class (KT-4174) internal class KotlinClass(): JavaClass({status="OK"}) { diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.java deleted file mode 100644 index b01de318b51..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.*; - -class WeirdComparator { - public T max(Comparator comparator, T value1, T value2) { - return comparator.compare(value1, value2) > 0 ? value1 : value2; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.kt index a440e7a700e..a539ef61169 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.kt @@ -1,3 +1,15 @@ +// FILE: WeirdComparator.java + +import java.util.*; + +class WeirdComparator { + public T max(Comparator comparator, T value1, T value2) { + return comparator.compare(value1, value2) > 0 ? value1 : value2; + } +} + +// FILE: 1.kt + fun box(): String { val wc = WeirdComparator() val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin") diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.java deleted file mode 100644 index e9357e22d27..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.java +++ /dev/null @@ -1,11 +0,0 @@ -import java.util.*; - -class WeirdComparator { - public static T max(Comparator comparator, T value1, T value2) { - return comparator.compare(value1, value2) > 0 ? value1 : value2; - } - - public static T max2(Comparator comparator, T value1, T value2) { - return comparator.compare(value1, value2) > 0 ? value1 : value2; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.kt index 1f20409dcb4..16b00976a01 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.kt @@ -1,3 +1,19 @@ +// FILE: WeirdComparator.java + +import java.util.*; + +class WeirdComparator { + public static T max(Comparator comparator, T value1, T value2) { + return comparator.compare(value1, value2) > 0 ? value1 : value2; + } + + public static T max2(Comparator comparator, T value1, T value2) { + return comparator.compare(value1, value2) > 0 ? value1 : value2; + } +} + +// FILE: 1.kt + fun box(): String { val result = WeirdComparator.max({ a, b -> a.length - b.length }, "java", "kotlin") if (result != "kotlin") return "Wrong: $result" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.java b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.java deleted file mode 100644 index 6d7f36ca017..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.*; - -class WeirdComparator { - public Inner createInner() { - return new Inner(); - } - - public class Inner { - public T max(Comparator comparator, T value1, T value2) { - return comparator.compare(value1, value2) > 0 ? value1 : value2; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.kt index 4788b8b669a..330c8fdf11d 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.kt @@ -1,3 +1,21 @@ +// FILE: WeirdComparator.java + +import java.util.*; + +class WeirdComparator { + public Inner createInner() { + return new Inner(); + } + + public class Inner { + public T max(Comparator comparator, T value1, T value2) { + return comparator.compare(value1, value2) > 0 ? value1 : value2; + } + } +} + +// FILE: 1.kt + fun box(): String { val wc = WeirdComparator().createInner()!! val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin") diff --git a/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.java b/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.java deleted file mode 100644 index c6f8175bd8b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.java +++ /dev/null @@ -1,5 +0,0 @@ -class Custom { - public interface Runnable { - void run2(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.kt b/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.kt index 4b842c14421..ccfd4537fbd 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.kt @@ -1,7 +1,17 @@ +// FILE: Custom.java + +class Custom { + public interface Runnable { + void run2(); + } +} + +// FILE: 1.kt + fun box(): String { val f = { } val class1 = Runnable(f).javaClass val class2 = Custom.Runnable(f).javaClass return if (class1 != class2) "OK" else "Same class: $class1" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java deleted file mode 100644 index a8989e7017f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java +++ /dev/null @@ -1,6 +0,0 @@ -interface Base { - void call(T t); -} - -interface Derived extends Base { -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt index 07c6dadf65e..83c3e40cfbe 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt @@ -1,3 +1,16 @@ +// FILE: Base.java + +interface Base { + void call(T t); +} + +// FILE: Derived.java + +interface Derived extends Base { +} + +// FILE: 1.kt + fun box(): String { Base{}.call("") Derived{}.call("") diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java deleted file mode 100644 index 6ff3b5e69e6..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java +++ /dev/null @@ -1,8 +0,0 @@ -class ParamBase {} - -interface F extends FBase> { -} - -interface FBase { - void call(T t); -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt index f492b48eb3a..9434c9a894e 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt @@ -1,3 +1,20 @@ +// FILE: ParamBase.java + +class ParamBase {} + +// FILE: F.java + +interface F extends FBase> { +} + +// FILE: FBase.java + +interface FBase { + void call(T t); +} + +// FILE: 1.kt + fun box(): String { F>({}).call(ParamBase()) return "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.java b/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.java deleted file mode 100644 index 25856ed995a..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.java +++ /dev/null @@ -1,9 +0,0 @@ -class JavaClass { - interface Computable { - T compute(); - } - - static T compute(Computable computable) { - return computable.compute(); - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt b/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt index ad77cf52cf5..5eb7445c9e2 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt @@ -1,3 +1,17 @@ +// FILE: JavaClass.java + +class JavaClass { + interface Computable { + T compute(); + } + + static T compute(Computable computable) { + return computable.compute(); + } +} + +// FILE: 1.kt + import java.util.Arrays fun box(): String { diff --git a/compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.kt b/compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.kt deleted file mode 100644 index 20fec2031b8..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun box(): String { - val cb: CharBuffer = CharBuffer.impl() - - return cb.get(0).toString() + (cb as CharSequence).get(1).toString() -} diff --git a/compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.java b/compiler/testData/codegen/boxAgainstJava/specialBuiltins/charBuffer.kt similarity index 80% rename from compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.java rename to compiler/testData/codegen/boxAgainstJava/specialBuiltins/charBuffer.kt index 604a41846c7..73db39b2d4d 100644 --- a/compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.java +++ b/compiler/testData/codegen/boxAgainstJava/specialBuiltins/charBuffer.kt @@ -1,3 +1,5 @@ +// FILE: CharBuffer.java + public abstract class CharBuffer implements CharSequence { public final int length() { return 0; @@ -25,3 +27,11 @@ public abstract class CharBuffer implements CharSequence { }; } } + +// FILE: 1.kt + +fun box(): String { + val cb: CharBuffer = CharBuffer.impl() + + return cb.get(0).toString() + (cb as CharSequence).get(1).toString() +} diff --git a/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.java b/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.java deleted file mode 100644 index f3b30b86949..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.java +++ /dev/null @@ -1,7 +0,0 @@ -package test; - -public class classWithNestedEnum { - public enum E { ENTRY } - - public static String foo() { return "OK"; } -} diff --git a/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.kt b/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.kt index 2d93739599c..4b5b614455f 100644 --- a/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.kt +++ b/compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.kt @@ -1,5 +1,17 @@ +// FILE: test/JavaClass.java + +package test; + +public class JavaClass { + public enum E { ENTRY } + + public static String foo() { return "OK"; } +} + +// FILE: 1.kt + package test fun box(): String { - return classWithNestedEnum.foo()!! + return JavaClass.foo()!! } diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.java deleted file mode 100644 index b0c502c2e5d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.java +++ /dev/null @@ -1,3 +0,0 @@ -public class _protected { - protected String getOk() { return "OK"; } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.kt deleted file mode 100644 index 2b0cece6e0f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.kt +++ /dev/null @@ -1,11 +0,0 @@ -package p - -import _protected - -fun box(): String { - return KotlinClass().ok() -} - -class KotlinClass : _protected() { - fun ok() = ok -} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.java deleted file mode 100644 index 3a71175b66e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.java +++ /dev/null @@ -1,6 +0,0 @@ -public class _protectedSetter { - private String x = null; - - public String getX() { return "OK"; } - protected void setX(String x) { this.x = x; } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.kt deleted file mode 100644 index 58fd8472e9b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.kt +++ /dev/null @@ -1,15 +0,0 @@ -package p - -import _protectedSetter - -fun box(): String { - return KotlinClass().ok() -} - -class KotlinClass : _protectedSetter() { - fun ok(): String { - x = "o" - x += "k" - return x - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.java deleted file mode 100644 index 43794724a9c..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.java +++ /dev/null @@ -1,14 +0,0 @@ -interface A { - String getOk(); -} - -interface B { - String getOk(); -} - -interface C extends A, B { -} - -class JavaClass implements C { - public String getOk() { return "OK"; } -} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.kt index ae25638a948..62682c70cc4 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.kt @@ -1,3 +1,24 @@ +// FILE: C.java + +interface A { + String getOk(); +} + +interface B { + String getOk(); +} + +interface C extends A, B { +} + +// FILE: JavaClass.java + +class JavaClass implements C { + public String getOk() { return "OK"; } +} + +// FILE: 1.kt + fun box(): String { return f(JavaClass()) } diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.java deleted file mode 100644 index a28f5ff490d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.java +++ /dev/null @@ -1,3 +0,0 @@ -class JavaClass { - public String getOk() { return "OK"; } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.kt index de99f3e9890..eebe2d3d855 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.kt @@ -1,3 +1,11 @@ +// FILE: JavaClass.java + +class JavaClass { + public String getOk() { return "OK"; } +} + +// FILE: 1.kt + fun box(): String { return JavaClass().ok } diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.java deleted file mode 100644 index 48b5ecade7b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private String myX; - - public String getX() { - return myX; - } - - public void setX(String x) { - myX = x; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.kt index ecdc093eab1..165afb33d56 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private String myX; + + public String getX() { + return myX; + } + + public void setX(String x) { + myX = x; + } +} + +// FILE: 1.kt + fun box(): String { return JavaClass().doIt() } diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.java deleted file mode 100644 index 4a7ab421bc5..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.java +++ /dev/null @@ -1,10 +0,0 @@ -class JavaClass1 { - protected Object value = null; - - public Object getSomething() { return null; } - public void setSomething(Object value) { this.value = value; } -} - -class JavaClass2 extends JavaClass1 { - public String getSomething() { return (String)value; } -} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.kt index cd8d6552080..b257e7ae6a0 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.kt @@ -1,3 +1,18 @@ +// FILE: JavaClass2.java + +class JavaClass1 { + protected Object value = null; + + public Object getSomething() { return null; } + public void setSomething(Object value) { this.value = value; } +} + +class JavaClass2 extends JavaClass1 { + public String getSomething() { return (String)value; } +} + +// FILE: 1.kt + fun box(): String { val javaClass = JavaClass2() javaClass.something = "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.java deleted file mode 100644 index 0b0e9b587ca..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private int myX = 0; - - public int getX() { - return myX; - } - - public void setX(int x) { - myX = x; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.kt index 4f9f39e43d2..bbd1d6928b8 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private int myX = 0; + + public int getX() { + return myX; + } + + public void setX(int x) { + myX = x; + } +} + +// FILE: 1.kt + fun box(): String { val javaClass = JavaClass() javaClass.x++ diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protected.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protected.kt new file mode 100644 index 00000000000..855120c7143 --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protected.kt @@ -0,0 +1,19 @@ +// FILE: JavaClass.java + +public class JavaClass { + protected String getOk() { return "OK"; } +} + +// FILE: 1.kt + +package p + +import JavaClass + +fun box(): String { + return KotlinClass().ok() +} + +class KotlinClass : JavaClass() { + fun ok() = ok +} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protectedSetter.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protectedSetter.kt new file mode 100644 index 00000000000..259ce8e0735 --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protectedSetter.kt @@ -0,0 +1,26 @@ +// FILE: JavaClass.java + +public class JavaClass { + private String x = null; + + public String getX() { return "OK"; } + protected void setX(String x) { this.x = x; } +} + +// FILE: 1.kt + +package p + +import JavaClass + +fun box(): String { + return KotlinClass().ok() +} + +class KotlinClass : JavaClass() { + fun ok(): String { + x = "o" + x += "k" + return x + } +} diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.java deleted file mode 100644 index 48b5ecade7b..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.java +++ /dev/null @@ -1,11 +0,0 @@ -class JavaClass { - private String myX; - - public String getX() { - return myX; - } - - public void setX(String x) { - myX = x; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.kt index 1be9b657a1b..9d1ce3b4f55 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +class JavaClass { + private String myX; + + public String getX() { + return myX; + } + + public void setX(String x) { + myX = x; + } +} + +// FILE: 1.kt + fun box(): String { val javaClass = JavaClass() javaClass.x = "OK" diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.java deleted file mode 100644 index 55155e946d6..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.java +++ /dev/null @@ -1,12 +0,0 @@ -class JavaClass { - private String myX = ""; - - public String getX() { - return myX; - } - - public JavaClass setX(String x) { - myX = x; - return this; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.kt index bfc058a54b0..408816e4bc4 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.kt @@ -1,3 +1,20 @@ +// FILE: JavaClass.java + +class JavaClass { + private String myX = ""; + + public String getX() { + return myX; + } + + public JavaClass setX(String x) { + myX = x; + return this; + } +} + +// FILE: 1.kt + fun box(): String { val javaClass = JavaClass() if (javaClass.x.isEmpty()) { diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.java b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.java deleted file mode 100644 index 3af73d0e17e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.java +++ /dev/null @@ -1,12 +0,0 @@ -class JavaClass { - private String myX = ""; - - public String getX() { - return myX; - } - - public double setX(String x) { - myX = x; - return 1.0; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.kt b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.kt index bfc058a54b0..904c9448f58 100644 --- a/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.kt +++ b/compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.kt @@ -1,3 +1,20 @@ +// FILE: JavaClass.java + +class JavaClass { + private String myX = ""; + + public String getX() { + return myX; + } + + public double setX(String x) { + myX = x; + return 1.0; + } +} + +// FILE: 1.kt + fun box(): String { val javaClass = JavaClass() if (javaClass.x.isEmpty()) { diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.java b/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.java deleted file mode 100644 index 68924bb5134..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.java +++ /dev/null @@ -1,9 +0,0 @@ -import java.lang.String; - -class J { - String value; - - J(String value) { - this.value = value; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.kt b/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.kt index e55a25ffd59..f3c423b1d70 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.kt @@ -1 +1,15 @@ +// FILE: J.java + +import java.lang.String; + +class J { + String value; + + J(String value) { + this.value = value; + } +} + +// FILE: 1.kt + fun box() = J("OK").value diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.java deleted file mode 100644 index 3879960423f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.java +++ /dev/null @@ -1,9 +0,0 @@ -package protectedPack; - -import java.lang.String; - -class packageClass { - public String test() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.kt index 13b9e6dc782..a637d077e6e 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.kt @@ -1,5 +1,17 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +class J { + public String test() { + return "OK"; + } +} + +// FILE: 1.kt + package protectedPack fun box(): String { - return packageClass().test()!! + return J().test()!! } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.java b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.java deleted file mode 100644 index e1f04d5cd51..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.java +++ /dev/null @@ -1,9 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class packageFun { - String test() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.kt b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.kt index 43d1f058b2a..d860abd5307 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.kt @@ -1,5 +1,17 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + String test() { + return "OK"; + } +} + +// FILE: 1.kt + package protectedPack fun box(): String { - return packageFun().test()!! + return J().test()!! } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.java b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.java deleted file mode 100644 index 03e5285c389..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.java +++ /dev/null @@ -1,7 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class packageProperty { - String test = "OK"; -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.kt b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.kt index bc20f5ffff7..478ed01a79c 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.kt @@ -1,5 +1,15 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + String test = "OK"; +} + +// FILE: 1.kt + package protectedPack fun box(): String { - return packageProperty().test!! + return J().test!! } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.java deleted file mode 100644 index 40b91da9818..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.java +++ /dev/null @@ -1,9 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class overrideProtectedFunInPackage { - protected String foo() { - return "fail"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.kt index c372f368c72..30048a67dce 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.kt @@ -1,8 +1,20 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + protected String foo() { + return "fail"; + } +} + +// FILE: 1.kt + package protectedPackKotlin -import protectedPack.overrideProtectedFunInPackage +import protectedPack.J -class Derived: overrideProtectedFunInPackage() { +class Derived : J() { protected override fun foo(): String? { return "OK" } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.java deleted file mode 100644 index 4ded638d775..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.java +++ /dev/null @@ -1,9 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class protectedFunInPackage { - protected String foo() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.kt index e7180155bd8..21c46b6ef48 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.kt @@ -1,5 +1,17 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + protected String foo() { + return "OK"; + } +} + +// FILE: 1.kt + package protectedPack fun box(): String { - return protectedFunInPackage().foo()!! + return J().foo()!! } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.java deleted file mode 100644 index 52f8393d12c..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.java +++ /dev/null @@ -1,7 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class protectedPropertyInPackage { - protected String foo = "OK"; -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.kt index 93bef23ffba..ea30a93af3a 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.kt @@ -1,5 +1,15 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + protected String foo = "OK"; +} + +// FILE: 1.kt + package protectedPack fun box(): String { - return protectedPropertyInPackage().foo!! + return J().foo!! } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.java deleted file mode 100644 index c07f6404b1d..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.java +++ /dev/null @@ -1,11 +0,0 @@ -package protectedPack; - -import java.lang.String; - -public class protectedStaticClass { - protected static class Inner { - public String foo() { - return "OK"; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.kt index 728a19cdd9e..0f54fc2519a 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.kt @@ -1,11 +1,25 @@ +// FILE: protectedPack/J.java + +package protectedPack; + +public class J { + protected static class Inner { + public String foo() { + return "OK"; + } + } +} + +// FILE: 1.kt + package protectedPack -class Derived(): protectedStaticClass() { +class Derived : J() { fun test(): String { - return protectedStaticClass.Inner().foo()!! + return J.Inner().foo()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.java deleted file mode 100644 index bd2de53a7de..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.java +++ /dev/null @@ -1,12 +0,0 @@ -public class funCallInConstructor { - - protected final String protectedProperty; - - public funCallInConstructor(String str) { - protectedProperty = str; - } - - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.kt index f1cf3e893a2..f9af830d907 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.kt @@ -1,9 +1,25 @@ -class A: funCallInConstructor(funCallInConstructor.protectedFun()) { - fun test(): String { - return protectedProperty!! - } +// FILE: J.java + +public class J { + protected final String protectedProperty; + + public J(String str) { + protectedProperty = str; + } + + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +class A : J(J.protectedFun()) { + fun test(): String { + return protectedProperty!! + } } fun box(): String { - return A().test() + return A().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.java deleted file mode 100644 index 065086cd1fb..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.java +++ /dev/null @@ -1,6 +0,0 @@ -public class funClassObject { - - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.kt index 2e48215123d..76054694c40 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.kt @@ -1,11 +1,21 @@ -class A { - companion object: funClassObject() { - fun test(): String { - return funClassObject.protectedFun()!! +// FILE: J.java + +public class J { + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +class A { + companion object : J() { + fun test(): String { + return J.protectedFun()!! + } } - } } fun box(): String { - return A.test() + return A.test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.java deleted file mode 100644 index bfa4ed26b70..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class funGenericClass { - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.kt index 4eb9910c441..774e47b8899 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.kt @@ -1,9 +1,19 @@ -class Derived(): funGenericClass() { +// FILE: J.java + +public class J { + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +class Derived : J() { fun test(): String { - return funGenericClass.protectedFun()!! + return J.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.java deleted file mode 100644 index 53c62202cb6..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.java +++ /dev/null @@ -1,7 +0,0 @@ -public class funNestedStaticClass { - public static class Inner { - protected static String protectedFun() { - return "OK"; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.kt index 1a681f5c34a..1a1f11fca35 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.kt @@ -1,9 +1,21 @@ -class Derived(): funNestedStaticClass.Inner() { +// FILE: J.java + +public class J { + public static class Inner { + protected static String protectedFun() { + return "OK"; + } + } +} + +// FILE: 1.kt + +class Derived : J.Inner() { fun test(): String { - return funNestedStaticClass.Inner.protectedFun()!! + return J.Inner.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.java deleted file mode 100644 index 449910aa583..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.java +++ /dev/null @@ -1,9 +0,0 @@ -public class funNestedStaticClass2 { - public static class A { - public static class B { - protected static String protectedFun() { - return "OK"; - } - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.kt index 50d7d7b0f8b..7c2868a1ac0 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.kt @@ -1,9 +1,23 @@ -class Derived(): funNestedStaticClass2.A.B() { +// FILE: J.java + +public class J { + public static class A { + public static class B { + protected static String protectedFun() { + return "OK"; + } + } + } +} + +// FILE: 1.kt + +class Derived : J.A.B() { fun test(): String { - return funNestedStaticClass2.A.B.protectedFun()!! + return J.A.B.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.java deleted file mode 100644 index c47c8420a3e..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.java +++ /dev/null @@ -1,7 +0,0 @@ -public class funNestedStaticGenericClass { - public static class Inner { - protected static String protectedFun() { - return "OK"; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.kt index 7c5c35aa82f..3b13d4d9212 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.kt @@ -1,9 +1,21 @@ -class Derived(): funNestedStaticGenericClass.Inner() { +// FILE: J.java + +public class J { + public static class Inner { + protected static String protectedFun() { + return "OK"; + } + } +} + +// FILE: 1.kt + +class Derived : J.Inner() { fun test(): String { - return funNestedStaticGenericClass.Inner.protectedFun()!! + return J.Inner.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.java deleted file mode 100644 index c9a32d895a3..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class funNotDirectSuperClass { - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.kt index 64c6a6ff105..b467ac75a02 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.kt @@ -1,12 +1,21 @@ -open class A : funNotDirectSuperClass() {} +// FILE: J.java -class Derived(): A() { +public class J { + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +open class A : J() {} + +class Derived : A() { fun test(): String { - return funNotDirectSuperClass.protectedFun()!! + return J.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } - diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.java deleted file mode 100644 index b0d41cfb4f9..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.java +++ /dev/null @@ -1,6 +0,0 @@ -public class funObject { - - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.kt index 3d576508c6c..dad18a9f3c1 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.kt @@ -1,9 +1,19 @@ -object A: funObject() { - fun test(): String { - return funObject.protectedFun()!! - } +// FILE: J.java + +public class J { + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +object A : J() { + fun test(): String { + return J.protectedFun()!! + } } fun box(): String { - return A.test() + return A.test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.java deleted file mode 100644 index 1af03cb7f01..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.java +++ /dev/null @@ -1,8 +0,0 @@ -public class simpleClass { - protected static class Inner { - public Inner() {} - public String foo() { - return "OK"; - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.kt index c10cb6bd87a..d96ced04cd1 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.kt @@ -1,9 +1,22 @@ -class Derived(): simpleClass() { +// FILE: Base.java + +public class Base { + protected static class Inner { + public Inner() {} + public String foo() { + return "OK"; + } + } +} + +// FILE: 1.kt + +class Derived : Base() { fun test(): String { - return simpleClass.Inner().foo()!! + return Base.Inner().foo()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.java deleted file mode 100644 index eab24a999c3..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.java +++ /dev/null @@ -1,12 +0,0 @@ -public class simpleClass2 { - public static class A { - protected static class B { - public B() { - } - - public String foo() { - return "OK"; - } - } - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.kt index 824b0f5458b..b424a86e23c 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.kt @@ -1,9 +1,26 @@ -class Derived(): simpleClass2.A() { +// FILE: Base.java + +public class Base { + public static class A { + protected static class B { + public B() { + } + + public String foo() { + return "OK"; + } + } + } +} + +// FILE: 1.kt + +class Derived : Base.A() { fun test(): String { - return simpleClass2.A.B().foo()!! + return Base.A.B().foo()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.java deleted file mode 100644 index 03fea7a6196..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.java +++ /dev/null @@ -1,5 +0,0 @@ -public class simpleFun { - protected static String protectedFun() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.kt index 7f76e10ba62..41dc7c34ac0 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.kt @@ -1,9 +1,19 @@ -class Derived(): simpleFun() { +// FILE: Base.java + +public class Base { + protected static String protectedFun() { + return "OK"; + } +} + +// FILE: 1.kt + +class Derived : Base() { fun test(): String { - return simpleFun.protectedFun()!! + return Base.protectedFun()!! } } fun box(): String { - return Derived().test() + return Derived().test() } diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.java b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.java deleted file mode 100644 index 925543fa33f..00000000000 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.java +++ /dev/null @@ -1,3 +0,0 @@ -public class simpleProperty { - protected static final String protectedProperty = "OK"; -} diff --git a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.kt b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.kt index 9d0448338dd..516d168d325 100644 --- a/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.kt +++ b/compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.kt @@ -1,10 +1,17 @@ -class Derived(): simpleProperty() { +// FILE: Base.java + +public class Base { + protected static final String protectedProperty = "OK"; +} + +// FILE: 1.kt + +class Derived : Base() { fun test(): String { - return simpleProperty.protectedProperty!! + return Base.protectedProperty!! } } fun box(): String { - return Derived().test() + return Derived().test() } - diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index 6c46d783ffa..d00eb3376bc 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -47,6 +47,8 @@ import java.util.Collections; import java.util.List; import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava; +import static org.jetbrains.kotlin.test.KotlinTestUtils.compilerConfigurationForTests; +import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar; public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { @Override @@ -56,14 +58,10 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { blackBoxFileByFullPath(wholeFile.getPath()); } else { - doTestMultiFile(files); + doTestMultiFile(files, javaFilesDir); } } - protected void doTestAgainstJava(@NotNull String filename) { - blackBoxFileAgainstJavaByFullPath(filename); - } - protected void doTestWithJava(@NotNull String filename) { try { blackBoxFileWithJavaByFullPath(filename); @@ -85,8 +83,40 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { blackBoxFileByFullPath(filename); } - private void doTestMultiFile(@NotNull List files) { - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL); + private void doTestMultiFile(@NotNull List files, @Nullable File javaSourceDir) throws Exception { + TestJdkKind jdkKind = TestJdkKind.MOCK_JDK; + for (TestFile file : files) { + if (isFullJdkDirectiveDefined(file.content)) { + jdkKind = TestJdkKind.FULL_JDK; + break; + } + } + + File javaOutputDir; + if (javaSourceDir != null) { + final List javaSourceFilePaths = new ArrayList(); + FileUtil.processFilesRecursively(javaSourceDir, new Processor() { + @Override + public boolean process(File file) { + if (file.isFile() && file.getName().endsWith(".java")) { + javaSourceFilePaths.add(file.getPath()); + } + return true; + } + }); + + javaOutputDir = compileJava(javaSourceFilePaths, Collections.emptyList(), Collections.emptyList()); + } + else { + javaOutputDir = null; + } + + CompilerConfiguration configuration = + compilerConfigurationForTests(ConfigurationKind.ALL, jdkKind, getAnnotationsJar(), javaOutputDir); + + myEnvironment = + KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES); + loadMultiFiles(files); blackBox(); } @@ -98,25 +128,12 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { return TestJdkKind.FULL_JDK; } - return InTextDirectivesUtils.isDirectiveDefined( - FilesKt.readText(new File(sourcePath), Charsets.UTF_8), "FULL_JDK" - ) ? TestJdkKind.FULL_JDK : TestJdkKind.MOCK_JDK; + String content = FilesKt.readText(new File(sourcePath), Charsets.UTF_8); + return isFullJdkDirectiveDefined(content) ? TestJdkKind.FULL_JDK : TestJdkKind.MOCK_JDK; } - private void blackBoxFileAgainstJavaByFullPath(@NotNull String ktFileFullPath) { - String ktFile = relativePath(new File(ktFileFullPath)); - File javaClassesTempDirectory = compileJava(ktFile.replaceFirst("\\.kt$", ".java")); - - myEnvironment = KotlinCoreEnvironment.createForTests( - getTestRootDisposable(), - KotlinTestUtils.compilerConfigurationForTests( - ConfigurationKind.ALL, getTestJdkKind(ktFileFullPath), KotlinTestUtils.getAnnotationsJar(), javaClassesTempDirectory - ), - EnvironmentConfigFiles.JVM_CONFIG_FILES - ); - - loadFile(ktFile); - blackBox(); + private static boolean isFullJdkDirectiveDefined(@NotNull String content) { + return InTextDirectivesUtils.isDirectiveDefined(content, "FULL_JDK"); } private void blackBoxFileWithJavaByFullPath(@NotNull String directory) throws Exception { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java index 86fae3a1c7b..30a81608dbd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java @@ -46,49 +46,49 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("javaAnnotationArrayValueDefault.kt") public void testJavaAnnotationArrayValueDefault() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueDefault.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaAnnotationArrayValueNoDefault.kt") public void testJavaAnnotationArrayValueNoDefault() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationArrayValueNoDefault.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaAnnotationCall.kt") public void testJavaAnnotationCall() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationCall.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaAnnotationDefault.kt") public void testJavaAnnotationDefault() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaAnnotationDefault.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaNegativePropertyAsAnnotationParameter.kt") public void testJavaNegativePropertyAsAnnotationParameter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaPropertyAsAnnotationParameter.kt") public void testJavaPropertyAsAnnotationParameter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaPropertyWithIntInitializer.kt") public void testJavaPropertyWithIntInitializer() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("retentionInJava.kt") public void testRetentionInJava() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/retentionInJava.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping") @@ -102,37 +102,37 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("arrayClassParameter.kt") public void testArrayClassParameter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("arrayClassParameterOnJavaClass.kt") public void testArrayClassParameterOnJavaClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("classParameter.kt") public void testClassParameter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("classParameterOnJavaClass.kt") public void testClassParameterOnJavaClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/classParameterOnJavaClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("varargClassParameter.kt") public void testVarargClassParameter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("varargClassParameterOnJavaClass.kt") public void testVarargClassParameterOnJavaClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/varargClassParameterOnJavaClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } } @@ -148,25 +148,25 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("constructor.kt") public void testConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/callableReference/constructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("publicFinalField.kt") public void testPublicFinalField() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/callableReference/publicFinalField.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("publicMutableField.kt") public void testPublicMutableField() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/callableReference/publicMutableField.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("staticMethod.kt") public void testStaticMethod() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/callableReference/staticMethod.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -181,13 +181,13 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("genericConstructor.kt") public void testGenericConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/constructor/genericConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("secondaryConstructor.kt") public void testSecondaryConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/constructor/secondaryConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -202,7 +202,7 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("delegationAndInheritanceFromJava.kt") public void testDelegationAndInheritanceFromJava() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/delegation/delegationAndInheritanceFromJava.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -217,37 +217,37 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("simpleJavaEnum.kt") public void testSimpleJavaEnum() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnum.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleJavaEnumWithFunction.kt") public void testSimpleJavaEnumWithFunction() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithFunction.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleJavaEnumWithStaticImport.kt") public void testSimpleJavaEnumWithStaticImport() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaEnumWithStaticImport.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleJavaInnerEnum.kt") public void testSimpleJavaInnerEnum() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/simpleJavaInnerEnum.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("staticField.kt") public void testStaticField() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/staticField.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("staticMethod.kt") public void testStaticMethod() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/enum/staticMethod.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -262,31 +262,31 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("constructor.kt") public void testConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/functions/constructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("max.kt") public void testMax() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/functions/max.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("referencesStaticInnerClassMethod.kt") public void testReferencesStaticInnerClassMethod() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethod.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("referencesStaticInnerClassMethodL2.kt") public void testReferencesStaticInnerClassMethodL2() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/functions/referencesStaticInnerClassMethodL2.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("unrelatedUpperBounds.kt") public void testUnrelatedUpperBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/functions/unrelatedUpperBounds.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -301,19 +301,19 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("kt3532.kt") public void testKt3532() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/innerClass/kt3532.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("kt3812.kt") public void testKt3812() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/innerClass/kt3812.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("kt4036.kt") public void testKt4036() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/innerClass/kt4036.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -328,7 +328,7 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("inheritJavaInterface.kt") public void testInheritJavaInterface() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/interfaces/inheritJavaInterface.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -340,16 +340,16 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/notNullAssertions"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("Delegation.kt") + @TestMetadata("delegation.kt") public void testDelegation() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/notNullAssertions/Delegation.kt"); - doTestAgainstJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt"); + doTest(fileName); } - @TestMetadata("RightElvisOperand.kt") + @TestMetadata("rightElvisOperand.kt") public void testRightElvisOperand() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/notNullAssertions/RightElvisOperand.kt"); - doTestAgainstJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt"); + doTest(fileName); } } @@ -361,10 +361,10 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/platformTypes"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("GenericUnit.kt") + @TestMetadata("genericUnit.kt") public void testGenericUnit() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/platformTypes/GenericUnit.kt"); - doTestAgainstJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/platformTypes/genericUnit.kt"); + doTest(fileName); } } @@ -379,19 +379,19 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("fieldAccessFromExtensionInTraitImpl.kt") public void testFieldAccessFromExtensionInTraitImpl() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/property/fieldAccessFromExtensionInTraitImpl.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("fieldAccessViaSubclass.kt") public void testFieldAccessViaSubclass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/property/fieldAccessViaSubclass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("referenceToJavaFieldViaBridge.kt") public void testReferenceToJavaFieldViaBridge() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/property/referenceToJavaFieldViaBridge.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -414,7 +414,7 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("javaClassLiteral.kt") public void testJavaClassLiteral() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/classLiterals/javaClassLiteral.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -429,25 +429,25 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("jClass2kClass.kt") public void testJClass2kClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/mapping/jClass2kClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaConstructor.kt") public void testJavaConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaFields.kt") public void testJavaFields() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaFields.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("javaMethods.kt") public void testJavaMethods() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/mapping/javaMethods.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -462,7 +462,7 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("equalsHashCodeToString.kt") public void testEqualsHashCodeToString() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/reflection/properties/equalsHashCodeToString.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } } @@ -478,25 +478,25 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("differentFqNames.kt") public void testDifferentFqNames() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/differentFqNames.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("kt4753.kt") public void testKt4753() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("kt4753_2.kt") public void testKt4753_2() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("samConstructorGenericSignature.kt") public void testSamConstructorGenericSignature() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters") @@ -510,169 +510,169 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("bridgesForOverridden.kt") public void testBridgesForOverridden() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverridden.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("bridgesForOverriddenComplex.kt") public void testBridgesForOverriddenComplex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/bridgesForOverriddenComplex.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("callAbstractAdapter.kt") public void testCallAbstractAdapter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/callAbstractAdapter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("comparator.kt") public void testComparator() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/comparator.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("constructor.kt") public void testConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/constructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("doubleLongParameters.kt") public void testDoubleLongParameters() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/doubleLongParameters.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("fileFilter.kt") public void testFileFilter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/fileFilter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("genericSignature.kt") public void testGenericSignature() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/genericSignature.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("implementAdapter.kt") public void testImplementAdapter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/implementAdapter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("inheritedInKotlin.kt") public void testInheritedInKotlin() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedInKotlin.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("inheritedOverriddenAdapter.kt") public void testInheritedOverriddenAdapter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedOverriddenAdapter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("inheritedSimple.kt") public void testInheritedSimple() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/inheritedSimple.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/localClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("localObjectConstructor.kt") public void testLocalObjectConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("localObjectConstructorWithFnValue.kt") public void testLocalObjectConstructorWithFnValue() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/localObjectConstructorWithFnValue.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("nonLiteralAndLiteralRunnable.kt") public void testNonLiteralAndLiteralRunnable() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralAndLiteralRunnable.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("nonLiteralComparator.kt") public void testNonLiteralComparator() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("nonLiteralInConstructor.kt") public void testNonLiteralInConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralInConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("nonLiteralNull.kt") public void testNonLiteralNull() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralNull.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("nonLiteralRunnable.kt") public void testNonLiteralRunnable() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralRunnable.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("protectedFromBase.kt") public void testProtectedFromBase() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/protectedFromBase.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("severalSamParameters.kt") public void testSeveralSamParameters() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/severalSamParameters.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simplest.kt") public void testSimplest() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/simplest.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("superconstructor.kt") public void testSuperconstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("superconstructorWithClosure.kt") public void testSuperconstructorWithClosure() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/superconstructorWithClosure.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("typeParameterOfClass.kt") public void testTypeParameterOfClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("typeParameterOfMethod.kt") public void testTypeParameterOfMethod() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfMethod.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("typeParameterOfOuterClass.kt") public void testTypeParameterOfOuterClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/typeParameterOfOuterClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators") @@ -686,67 +686,67 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("augmentedAssignmentAndSquareBrackets.kt") public void testAugmentedAssignmentAndSquareBrackets() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentAndSquareBrackets.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("augmentedAssignmentPure.kt") public void testAugmentedAssignmentPure() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentPure.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("augmentedAssignmentViaSimpleBinary.kt") public void testAugmentedAssignmentViaSimpleBinary() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/augmentedAssignmentViaSimpleBinary.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("binary.kt") public void testBinary() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/binary.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("compareTo.kt") public void testCompareTo() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/compareTo.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("contains.kt") public void testContains() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/contains.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("get.kt") public void testGet() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/get.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("invoke.kt") public void testInvoke() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/invoke.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("multiGetSet.kt") public void testMultiGetSet() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiGetSet.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("multiInvoke.kt") public void testMultiInvoke() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/multiInvoke.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("set.kt") public void testSet() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/adapters/operators/set.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } } @@ -760,10 +760,10 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/specialBuiltins"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("CharBuffer.kt") + @TestMetadata("charBuffer.kt") public void testCharBuffer() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/specialBuiltins/CharBuffer.kt"); - doTestAgainstJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/specialBuiltins/charBuffer.kt"); + doTest(fileName); } } @@ -778,7 +778,7 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("classWithNestedEnum.kt") public void testClassWithNestedEnum() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/staticFun/classWithNestedEnum.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -793,61 +793,61 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("fromTwoBases.kt") public void testFromTwoBases() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/fromTwoBases.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("getter.kt") public void testGetter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/getter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("implicitReceiver.kt") public void testImplicitReceiver() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/implicitReceiver.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("overrideOnlyGetter.kt") public void testOverrideOnlyGetter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/overrideOnlyGetter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("plusPlus.kt") public void testPlusPlus() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/plusPlus.kt"); - doTestAgainstJava(fileName); + doTest(fileName); + } + + @TestMetadata("protected.kt") + public void testProtected() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protected.kt"); + doTest(fileName); + } + + @TestMetadata("protectedSetter.kt") + public void testProtectedSetter() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/protectedSetter.kt"); + doTest(fileName); } @TestMetadata("setter.kt") public void testSetter() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("setterNonVoid1.kt") public void testSetterNonVoid1() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid1.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("setterNonVoid2.kt") public void testSetterNonVoid2() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/setterNonVoid2.kt"); - doTestAgainstJava(fileName); - } - - @TestMetadata("_protected.kt") - public void test_protected() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protected.kt"); - doTestAgainstJava(fileName); - } - - @TestMetadata("_protectedSetter.kt") - public void test_protectedSetter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/syntheticExtensions/_protectedSetter.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -870,25 +870,25 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("kt2781.kt") public void testKt2781() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/package/kt2781.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("packageClass.kt") public void testPackageClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/package/packageClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("packageFun.kt") public void testPackageFun() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/package/packageFun.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("packageProperty.kt") public void testPackageProperty() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/package/packageProperty.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -903,25 +903,25 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("overrideProtectedFunInPackage.kt") public void testOverrideProtectedFunInPackage() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/overrideProtectedFunInPackage.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("protectedFunInPackage.kt") public void testProtectedFunInPackage() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedFunInPackage.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("protectedPropertyInPackage.kt") public void testProtectedPropertyInPackage() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedPropertyInPackage.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("protectedStaticClass.kt") public void testProtectedStaticClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedAndPackage/protectedStaticClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } @@ -936,73 +936,73 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod @TestMetadata("funCallInConstructor.kt") public void testFunCallInConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funCallInConstructor.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funClassObject.kt") public void testFunClassObject() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funClassObject.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funGenericClass.kt") public void testFunGenericClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funGenericClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funNestedStaticClass.kt") public void testFunNestedStaticClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funNestedStaticClass2.kt") public void testFunNestedStaticClass2() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticClass2.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funNestedStaticGenericClass.kt") public void testFunNestedStaticGenericClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNestedStaticGenericClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funNotDirectSuperClass.kt") public void testFunNotDirectSuperClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funNotDirectSuperClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("funObject.kt") public void testFunObject() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/funObject.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleClass.kt") public void testSimpleClass() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleClass2.kt") public void testSimpleClass2() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleClass2.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleFun.kt") public void testSimpleFun() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleFun.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } @TestMetadata("simpleProperty.kt") public void testSimpleProperty() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/visibility/protectedStatic/simpleProperty.kt"); - doTestAgainstJava(fileName); + doTest(fileName); } } } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 970118200ad..8d920dcd37c 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -206,7 +206,7 @@ fun main(args: Array) { } testClass("BlackBoxAgainstJavaCodegenTestGenerated") { - model("codegen/boxAgainstJava", testMethod = "doTestAgainstJava") + model("codegen/boxAgainstJava") } testClass("BlackBoxWithJavaCodegenTestGenerated") {