New J2K: Split old j2k and new j2k tests

This commit is contained in:
Ilya Kirillov
2019-03-28 14:20:17 +03:00
committed by Ilya Kirillov
parent 02a206bf7c
commit b411e8e18e
1631 changed files with 14067 additions and 1513 deletions
@@ -0,0 +1,28 @@
public @interface Ann {
Inner[] value();
InnerParam[] test1() default @InnerParam(C.class);
}
public @interface Inner {
}
public @interface InnerParam {
Class<?> value();
}
@Ann(value = {@Inner, @Inner}, test1 = { @InnerParam(C.class) })
public class C {
}
@Ann({@Inner, @Inner})
public class D {
}
@Ann(value = @Inner)
public class E {
}
@Ann(value = {@Inner}, test1 = { @InnerParam(value = C.class) })
public class F {
}
@@ -0,0 +1,19 @@
import kotlin.reflect.KClass
annotation class Ann(vararg val value: Inner, val test1: Array<InnerParam> = [InnerParam(C::class)])
annotation class Inner
annotation class InnerParam(val value: KClass<*>)
@Ann(value = [Inner(), Inner()], test1 = [InnerParam(C::class)])
class C
@Ann(Inner(), Inner())
class D
@Ann(value = [Inner()])
class E
@Ann(value = [Inner()], test1 = [InnerParam(value = C::class)])
class F
+16
View File
@@ -0,0 +1,16 @@
public @interface Ann {
int i() default 1;
int[] i2() default 1;
int[] i3() default { 1 };
Class<?> klass() default A.class;
Class<?>[] klass2() default A.class;
Class<?>[] klass3() default { A.class };
Inner ann() default @Inner();
Inner[] ann2() default @Inner;
Inner[] ann3() default { @Inner, @Inner() };
}
public class A
public @interface Inner {
}
+6
View File
@@ -0,0 +1,6 @@
import kotlin.reflect.KClass
annotation class Ann(val i: Int = 1, val i2: IntArray = [1], val i3: IntArray = [1], val klass: KClass<*> = A::class, val klass2: Array<KClass<*>> = [A::class], val klass3: Array<KClass<*>> = [A::class], val ann: Inner = Inner(), val ann2: Array<Inner> = [Inner()], val ann3: Array<Inner> = [Inner(), Inner()])
class A
annotation class Inner
@@ -0,0 +1,16 @@
@interface A {
}
@interface B {
}
public class U {
@B
public int i;
public U(@A int i) {
this.i = i;
}
}
@@ -0,0 +1,6 @@
internal annotation class A
internal annotation class B
class U(@field:B @param:A
var i: Int)
@@ -0,0 +1,24 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@interface Anon {
String[] stringArray();
int[] intArray();
// string
String string();
}
@Anon(string = "a", stringArray = { "a", "b" }, intArray = { 1, 2 })
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD})
@interface I {
}
@Target(ElementType.METHOD)
@interface J {
}
@Target({})
@interface K {
}
@@ -0,0 +1,12 @@
internal annotation class Anon(val stringArray: Array<String>, val intArray: IntArray, // string
val string: String)
@Anon(string = "a", stringArray = ["a", "b"], intArray = [1, 2])
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
internal annotation class I
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
internal annotation class J
@Target
internal annotation class K
@@ -0,0 +1,8 @@
@interface Anon {
String s() default "a";
String[] stringArray() default { "a", "b" };
int[] intArray();
}
@Anon(intArray = {1, 2})
class A{ }
@@ -0,0 +1,4 @@
internal annotation class Anon(val s: String = "a", val stringArray: Array<String> = ["a", "b"], val intArray: IntArray)
@Anon(intArray = [1, 2])
internal class A
@@ -0,0 +1,14 @@
@interface Anon {
String value();
enum E {
A, B
}
E field = E.A;
}
@Anon("a")
interface I {
Anon.E e = Anon.field;
}
@@ -0,0 +1,18 @@
internal annotation class Anon(val value: String) {
enum class E {
A, B
}
companion object {
val field = E.A
}
}
@Anon("a")
internal interface I {
companion object {
val e = Anon.field
}
}
@@ -0,0 +1,24 @@
@interface Anon {
String[] value();
int x() default 1;
}
@Anon("a", "b")
interface I1 {
}
@Anon("c", "d", x = 1)
interface I2 {
}
@Anon({"c", "d"}, x = 1)
interface I3 {
}
@Anon(value = {"c", "d"})
interface I4 {
}
@@ -0,0 +1,13 @@
internal annotation class Anon(vararg val value: String, val x: Int = 1)
@Anon("a", "b")
internal interface I1
@Anon("c", "d", x = 1)
internal interface I2
@Anon("c", "d", x = 1)
internal interface I3
@Anon(value = ["c", "d"])
internal interface I4
+28
View File
@@ -0,0 +1,28 @@
import javaApi.*;
@Anon1(value = {"a"}, stringArray = {"b"}, intArray = {1, 2}, string = "x")
@Anon2(value = "a", intValue = 1, charValue = 'a')
@Anon3(e = E.A, stringArray = {}, value = {"a", "b"})
@Anon4({"x", "y"})
@Anon5(1)
@Anon6({"x", "y"})
@Anon7({ String.class, StringBuilder.class })
@Anon8(classes = { String.class, StringBuilder.class })
class C {
@Anon5(1) @Deprecated private int field1 = 0;
@Anon5(1)
private int field2 = 0;
@Anon5(1) int field3 = 0;
@Anon5(1)
int field4 = 0;
@Anon6({})
void foo(@Deprecated int p1, @Deprecated @Anon5(2) char p2) {
@Deprecated @Anon5(3) char c = 'a';
}
@Anon5(1) void bar(){}
}
+45
View File
@@ -0,0 +1,45 @@
// ERROR: This annotation is not applicable to target 'local variable'
// ERROR: This annotation is not applicable to target 'value parameter'
// ERROR: This annotation is not applicable to target 'value parameter'
import javaApi.Anon1
import javaApi.Anon2
import javaApi.Anon3
import javaApi.Anon4
import javaApi.Anon5
import javaApi.Anon6
import javaApi.Anon7
import javaApi.Anon8
import javaApi.E
@Anon1(value = ["a"], stringArray = ["b"], intArray = [1, 2], string = "x")
@Anon2(value = "a", intValue = 1, charValue = 'a')
@Anon3(e = E.A, stringArray = [], value = ["a", "b"])
@Anon4("x", "y")
@Anon5(1)
@Anon6("x", "y")
@Anon7(String::class, StringBuilder::class)
@Anon8(classes = [String::class, StringBuilder::class])
internal class C {
@Anon5(1)
@Deprecated("")
private val field1 = 0
@Anon5(1)
private val field2 = 0
@Anon5(1)
var field3 = 0
@Anon5(1)
var field4 = 0
@Anon6
fun foo(@Deprecated("") p1: Int, @Deprecated("") @Anon5(2) p2: Char) {
@Deprecated("") @Anon5(3) val c = 'a'
}
@Anon5(1)
fun bar() {
}
}
@@ -0,0 +1,18 @@
@interface An {
String value();
}
public class Test {
private int id;
@An(value = "get")
public int getId() {
return id;
}
@An(value = "set")
public void setId(int id) {
this.id = id
}
}
@@ -0,0 +1,8 @@
internal annotation class An(val value: String)
class Test {
@get:An(value = "get")
@set:An(value = "set")
var id = 0
}
@@ -0,0 +1,8 @@
@interface Ann {
Class<?> value();
Class<?> other();
}
@Ann(other = String.class, value = Object.class)
class C {
}
+6
View File
@@ -0,0 +1,6 @@
import kotlin.reflect.KClass
internal annotation class Ann(val value: KClass<*>, val other: KClass<*>)
@Ann(other = String::class, value = Any::class)
internal class C
@@ -0,0 +1,11 @@
@interface Ann {
Class<?>[] value();
}
@Ann({String.class, Object.class})
class C {
}
@Ann({})
class D {
}
@@ -0,0 +1,9 @@
import kotlin.reflect.KClass
internal annotation class Ann(vararg val value: KClass<*>)
@Ann(String::class, Any::class)
internal class C
@Ann
internal class D
+32
View File
@@ -0,0 +1,32 @@
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
package test;
import org.jetbrains.annotations.NotNull;
public class Test {
@NotNull String myStr = "String2";
public Test(@NotNull String str) {
myStr = str;
}
public void sout(@NotNull String str) {
// UNNECESSARY_NOT_NULL_ASSERTION heuristic does not work any more, instead we can skip generating !! altogether
System.out.println(str);
}
@NotNull
public String dummy(@NotNull String str) {
return str;
}
public void test() {
sout("String");
@NotNull String test = "String2";
sout(test);
sout(dummy(test));
new Test(test);
}
}
+22
View File
@@ -0,0 +1,22 @@
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
package test
class Test(internal var myStr: String) {
fun sout(str: String) {
// UNNECESSARY_NOT_NULL_ASSERTION heuristic does not work any more, instead we can skip generating !! altogether
println(str)
}
fun dummy(str: String): String {
return str
}
fun test() {
sout("String")
val test: String = "String2"
sout(test)
sout(dummy(test))
Test(test)
}
}
@@ -0,0 +1,24 @@
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
package test;
import org.jetbrains.annotations.NotNull;
class Foo {
void execute() {}
}
class Bar {
@NotNull
Foo fooNotNull = new Foo();
Foo fooNullable = null;
}
class Test {
public void test(@NotNull Bar barNotNull, Bar barNullable) {
barNotNull.fooNotNull.execute();
barNotNull.fooNullable.execute();
barNullable.fooNotNull.execute();
barNullable.fooNullable.execute();
}
}
@@ -0,0 +1,21 @@
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
package test
internal class Foo {
fun execute() {}
}
internal class Bar {
var fooNotNull = Foo()
var fooNullable: Foo? = null
}
internal class Test {
fun test(barNotNull: Bar, barNullable: Bar) {
barNotNull.fooNotNull.execute()
barNotNull.fooNullable!!.execute()
barNullable.fooNotNull.execute()
barNullable.fooNullable!!.execute()
}
}
+30
View File
@@ -0,0 +1,30 @@
// !specifyLocalVariableTypeByDefault: true
package test;
import org.jetbrains.annotations.Nullable;
public class Test {
@Nullable String myStr = "String2";
public Test(@Nullable String str) {
myStr = str;
}
public void sout(@Nullable String str) {
System.out.println(str);
}
@Nullable
public String dummy(@Nullable String str) {
return str;
}
public void test() {
sout("String");
@Nullable String test = "String2";
sout(test);
sout(dummy(test));
new Test(test);
}
}
+27
View File
@@ -0,0 +1,27 @@
// !specifyLocalVariableTypeByDefault: true
package test
class Test(str: String?) {
internal var myStr: String? = "String2"
init {
myStr = str
}
fun sout(str: String?) {
println(str)
}
fun dummy(str: String?): String? {
return str
}
fun test() {
sout("String")
val test: String? = "String2"
sout(test)
sout(dummy(test))
Test(test)
}
}
@@ -0,0 +1,11 @@
public class WithModifiersOnAccessors {
private synchronized void methSync() {}
protected strictfp void methStrict() {}
private int sync = 0;
public synchronized int getSync() { return sync; }
public synchronized void setSync(int sync) { this.sync = sync; }
public double strict = 0.0;
public strictfp double getStrict() { return strict; }
}
@@ -0,0 +1,17 @@
class WithModifiersOnAccessors {
@get:Synchronized
@set:Synchronized
var sync = 0
@get:Strictfp
val strict = 0.0
@Synchronized
private fun methSync() {
}
@Strictfp
protected fun methStrict() {
}
}
@@ -0,0 +1,5 @@
class C {
@Deprecated
public C() {
}
}
@@ -0,0 +1,2 @@
internal class C @Deprecated("")
constructor()
+12
View File
@@ -0,0 +1,12 @@
import java.io.Serializable;
public class Bar implements Serializable {
private static final long serialVersionUID = 0;
int foobar = 0;
}
public class Foo {
private static final long serialVersionUID = 0;
int foobar = 0;
}
+17
View File
@@ -0,0 +1,17 @@
import java.io.Serializable
class Bar : Serializable {
internal var foobar = 0
companion object {
private const val serialVersionUID: Long = 0
}
}
class Foo {
internal var foobar = 0
companion object {
private const val serialVersionUID: Long = 0
}
}
+16
View File
@@ -0,0 +1,16 @@
@SuppressWarnings("ALL")
public class A{
@SuppressWarnings("ALL")
public A(){
}
@SuppressWarnings("ALL")
public int b = 0;
@SuppressWarnings("ALL")
public void a(@SuppressWarnings("ALL") int i){
}
}
+8
View File
@@ -0,0 +1,8 @@
class A {
var b = 0
fun a(i: Int) {
}
}