Migrate boxAgainstJava tests to multi-file framework
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
String[] value() default {"d1", "d2"};
|
||||
}
|
||||
+12
@@ -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
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
String[] value();
|
||||
}
|
||||
+12
@@ -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
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
String value();
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
-18
@@ -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";
|
||||
}
|
||||
+28
@@ -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
|
||||
|
||||
|
||||
Vendored
-8
@@ -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;
|
||||
}
|
||||
Vendored
+14
-1
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
Vendored
-13
@@ -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;
|
||||
}
|
||||
+20
-2
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
-9
@@ -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;
|
||||
}
|
||||
+16
-2
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
Class<?>[] args();
|
||||
}
|
||||
+12
@@ -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
|
||||
|
||||
|
||||
-13
@@ -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 {}
|
||||
compiler/testData/codegen/boxAgainstJava/annotations/kClassMapping/arrayClassParameterOnJavaClass.kt
Vendored
+20
@@ -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"
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
Class<?> value();
|
||||
}
|
||||
+11
@@ -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
|
||||
|
||||
|
||||
Vendored
-12
@@ -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 {}
|
||||
Vendored
+18
@@ -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)
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface JavaAnn {
|
||||
Class<?>[] value();
|
||||
}
|
||||
+12
@@ -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
|
||||
|
||||
|
||||
-13
@@ -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 {}
|
||||
+20
@@ -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
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@interface Foo {
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user