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) {
}
}
+6
View File
@@ -0,0 +1,6 @@
class Test {
String str;
{
str = "Ola";
}
}
+7
View File
@@ -0,0 +1,7 @@
internal class Test {
var str: String? = null
init {
str = "Ola"
}
}
@@ -0,0 +1,6 @@
class Test {
static String str;
static {
str = "Ola";
}
}
@@ -0,0 +1,7 @@
internal object Test {
var str: String
init {
str = "Ola"
}
}
+32
View File
@@ -0,0 +1,32 @@
public class Test {
public Runnable someRunnable = new Runnable() {
@Override
public void run() {
someRunnable.run();
}
};
}
public class Test2 {
private Runnable someRunnable = new Runnable() {
@Override
public void run() {
someRunnable.run();
}
};
}
public class Handler {
public void postDelayed(Runnable r, long time) {}
}
public class Test3 {
private Handler handler = new Handler();
private Runnable someRunnable = new Runnable() {
@Override
public void run() {
handler.postDelayed(someRunnable, 1000);
}
};
}
+28
View File
@@ -0,0 +1,28 @@
class Test {
var someRunnable: Runnable = object : Runnable {
override fun run() {
this.run()
}
}
}
class Test2 {
private val someRunnable: Runnable = object : Runnable {
override fun run() {
this.run()
}
}
}
class Handler {
fun postDelayed(r: Runnable, time: Long) {}
}
class Test3 {
private val handler = Handler()
private val someRunnable: Runnable = object : Runnable {
override fun run() {
handler.postDelayed(this, 1000)
}
}
}
@@ -0,0 +1,11 @@
public class Test {
public void someMethod() {
Runnable someRunnable = new Runnable() {
@Override
public void run() {
someRunnable.run();
}
};
}
}
@@ -0,0 +1,9 @@
class Test {
fun someMethod() {
val someRunnable: Runnable = object : Runnable {
override fun run() {
this.run()
}
}
}
}
@@ -0,0 +1,2 @@
//expression
myArray[myLibrary.calculateIndex(100)]
@@ -0,0 +1 @@
myArray[myLibrary.calculateIndex(100)]
@@ -0,0 +1,2 @@
//expression
myArray[10]
@@ -0,0 +1 @@
myArray[10]
@@ -0,0 +1,2 @@
//expression
myArray[i]
@@ -0,0 +1 @@
myArray[i]
@@ -0,0 +1,2 @@
//statement
double[] a = new double[]{1.0, 2, 3}
@@ -0,0 +1 @@
val a = doubleArrayOf(1.0, 2.0, 3.0)
@@ -0,0 +1,3 @@
//statement
double a = 0, b = 0, c = 0;
double ds[] = {a, b, c};
@@ -0,0 +1,4 @@
val a = 0.0
val b = 0.0
val c = 0.0
val ds = doubleArrayOf(a, b, c)
@@ -0,0 +1,2 @@
//statement
float[] a = new float[]{1, 2, 3.0}
@@ -0,0 +1 @@
val a = floatArrayOf(1f, 2f, 3.0f)
@@ -0,0 +1,2 @@
//statement
int[] a = new int[10]
@@ -0,0 +1 @@
val a = IntArray(10)
@@ -0,0 +1,2 @@
//statement
java.lang.Double[] a = new java.lang.Double[]{1.0, 2.0, 3.0};
@@ -0,0 +1 @@
val a: Array<Double?> = arrayOf(1.0, 2.0, 3.0)
@@ -0,0 +1,2 @@
//statement
java.lang.Float[] a = new java.lang.Float[]{1.0f, 2f, 3f};
@@ -0,0 +1 @@
val a: Array<Float?> = arrayOf(1.0f, 2f, 3f)
@@ -0,0 +1,2 @@
//statement
byte[] a = new byte[] {1, 2, 3};
@@ -0,0 +1 @@
val a = byteArrayOf(1, 2, 3)
@@ -0,0 +1,2 @@
//expression
new int[] {1, 2, 3};
@@ -0,0 +1 @@
intArrayOf(1, 2, 3)
@@ -0,0 +1,2 @@
//statement
Object[] a = new Object[10]
@@ -0,0 +1 @@
val a: Array<Any?> = arrayOfNulls(10)
@@ -0,0 +1,2 @@
//statement
int[] a = {1, 2, 3};
@@ -0,0 +1 @@
val a = intArrayOf(1, 2, 3)
@@ -0,0 +1,3 @@
//statement
int a = 0, b = 0, c = 0;
int is[] = {a, b, c};
@@ -0,0 +1,4 @@
val a = 0
val b = 0
val c = 0
val `is` = intArrayOf(a, b, c)
@@ -0,0 +1,2 @@
//statement
int[][] a = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
@@ -0,0 +1 @@
val a = arrayOf(intArrayOf(1, 2, 3), intArrayOf(4, 5, 6), intArrayOf(7, 8, 9))
@@ -0,0 +1,2 @@
//statement
int [][] d2 = new int[][]{};
@@ -0,0 +1 @@
val d2: Array<IntArray?> = arrayOf()
@@ -0,0 +1,2 @@
//statement
int [][] d2 = new int[5][];
@@ -0,0 +1 @@
val d2: Array<IntArray?> = arrayOfNulls(5)
@@ -0,0 +1,2 @@
//statement
int [][][] d3 = new int[5][5][];
@@ -0,0 +1 @@
val d3 = Array<Array<IntArray>>(5) { arrayOfNulls(5) }
@@ -0,0 +1,2 @@
//statement
int [][] d2 = new int[5][5];
@@ -0,0 +1 @@
val d2 = Array(5) { IntArray(5) }
@@ -0,0 +1,2 @@
//statement
String [][] ss = new String[5][5];
+1
View File
@@ -0,0 +1 @@
val ss = Array<Array<String>>(5) { arrayOfNulls(5) }
@@ -0,0 +1,2 @@
//statement
String [][][] sss = new String[5][5][5];
+1
View File
@@ -0,0 +1 @@
val sss = Array(5) { Array<Array<String>>(5) { arrayOfNulls(5) } }
+2
View File
@@ -0,0 +1,2 @@
//statement
long[] a = new long[]{1, 2, 3}
+1
View File
@@ -0,0 +1 @@
val a = longArrayOf(1, 2, 3)
+2
View File
@@ -0,0 +1,2 @@
//method
void fromArrayToCollection(Foo[] a) {}
+1
View File
@@ -0,0 +1 @@
fun fromArrayToCollection(a: Array<Foo?>?) {}
+2
View File
@@ -0,0 +1,2 @@
//statement
int[] a = new int[]{1, 2, 3}
+1
View File
@@ -0,0 +1 @@
val a = intArrayOf(1, 2, 3)
+2
View File
@@ -0,0 +1,2 @@
//statement
String[] a = new String[]{"abc"}
+1
View File
@@ -0,0 +1 @@
val a: Array<String?> = arrayOf("abc")
+13
View File
@@ -0,0 +1,13 @@
abstract class C {
void foo() {
String s1 = f();
assert s1 != null;
String s2 = g();
assert s2 != null : "g should not return null";
int h = s2.hashCode();
}
abstract String f();
abstract String g();
}
+11
View File
@@ -0,0 +1,11 @@
internal abstract class C {
fun foo() {
val s1 = f()!!
val s2 = g() ?: error("g should not return null")
val h = s2.hashCode()
}
internal abstract fun f(): String?
internal abstract fun g(): String?
}
@@ -0,0 +1,2 @@
//statement
assert boolMethod();
+1
View File
@@ -0,0 +1 @@
assert(boolMethod())
@@ -0,0 +1,2 @@
//statement
assert(boolMethod());
@@ -0,0 +1 @@
assert(boolMethod())

Some files were not shown because too many files have changed in this diff Show More