j2k: flatten test cases and testData directory structure
Move j2k/test/tests -> j2k/tests, j2k/test/testData -> j2k/testData
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
class C {
|
||||
private String s = "";
|
||||
|
||||
void foo() {
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
private var s: String? = ""
|
||||
|
||||
fun foo() {
|
||||
s = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//file
|
||||
class C {
|
||||
private String s = x();
|
||||
|
||||
void foo() {
|
||||
if (s == null) {
|
||||
System.out.print("null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// ERROR: Unresolved reference: x
|
||||
class C {
|
||||
private val s = x()
|
||||
|
||||
fun foo() {
|
||||
if (s == null) {
|
||||
System.out.print("null")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//file
|
||||
class C {
|
||||
private String s;
|
||||
|
||||
public C(String s) {
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
void foo() {
|
||||
if (s != null) {
|
||||
System.out.print("not null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C(private val s: String?) {
|
||||
|
||||
fun foo() {
|
||||
if (s != null) {
|
||||
System.out.print("not null")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
class C {
|
||||
public String s = "";
|
||||
}
|
||||
|
||||
class D {
|
||||
void foo(C c) {
|
||||
if (null == c.s) {
|
||||
System.out.println("null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
public var s: String? = ""
|
||||
}
|
||||
|
||||
class D {
|
||||
fun foo(c: C) {
|
||||
if (null == c.s) {
|
||||
System.out.println("null")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//file
|
||||
class C {
|
||||
private String s;
|
||||
|
||||
public C(String s) {
|
||||
this.s = s;
|
||||
if (s == null) {
|
||||
System.out.print("null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C(private val s: String?) {
|
||||
|
||||
{
|
||||
if (s == null) {
|
||||
System.out.print("null")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
class C {
|
||||
private String s = null;
|
||||
|
||||
void foo() {
|
||||
s = "x";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
private var s: String? = null
|
||||
|
||||
fun foo() {
|
||||
s = "x"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
//file
|
||||
class C extends javaApi.Derived {
|
||||
public String foo(String s) { return s; }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class C : javaApi.Derived() {
|
||||
override fun foo(s: String?): String? {
|
||||
return s
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
class C {
|
||||
private void foo(String s){}
|
||||
|
||||
void bar() {
|
||||
foo(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
private fun foo(s: String?) {
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//file
|
||||
class C {
|
||||
public void foo(String s){}
|
||||
}
|
||||
|
||||
class D {
|
||||
void bar(C c) {
|
||||
c.foo(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
public fun foo(s: String?) {
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
fun bar(c: C) {
|
||||
c.foo(null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
class C {
|
||||
private void foo(String s){}
|
||||
|
||||
void bar(boolean b) {
|
||||
foo(b ? "a" : null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class C {
|
||||
private fun foo(s: String?) {
|
||||
}
|
||||
|
||||
fun bar(b: Boolean) {
|
||||
foo(if (b) "a" else null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
interface I {
|
||||
String getString();
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo(I i) {
|
||||
if (i.getString() == null) {
|
||||
println("null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
trait I {
|
||||
public fun getString(): String?
|
||||
}
|
||||
|
||||
class C {
|
||||
fun foo(i: I) {
|
||||
if (i.getString() == null) {
|
||||
println("null")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//file
|
||||
interface I {
|
||||
String getString();
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo(I i) {
|
||||
final String result = i.getString();
|
||||
if (result != null) {
|
||||
print(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
trait I {
|
||||
public fun getString(): String?
|
||||
}
|
||||
|
||||
class C {
|
||||
fun foo(i: I) {
|
||||
val result = i.getString()
|
||||
if (result != null) {
|
||||
print(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//file
|
||||
interface I {
|
||||
String getString();
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo(I i) {
|
||||
String result = i.getString();
|
||||
if (result != null) {
|
||||
print(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
trait I {
|
||||
public fun getString(): String?
|
||||
}
|
||||
|
||||
class C {
|
||||
fun foo(i: I) {
|
||||
val result = i.getString()
|
||||
if (result != null) {
|
||||
print(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//file
|
||||
interface I {
|
||||
String getString();
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo(I i, boolean b) {
|
||||
String result = i.getString();
|
||||
if (b) result = null;
|
||||
if (result != null) {
|
||||
print(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
trait I {
|
||||
public fun getString(): String
|
||||
}
|
||||
|
||||
class C {
|
||||
fun foo(i: I, b: Boolean) {
|
||||
var result: String? = i.getString()
|
||||
if (b) result = null
|
||||
if (result != null) {
|
||||
print(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class C {
|
||||
@Nullable private final String string = getString();
|
||||
|
||||
static String getString() { return x(); }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// ERROR: Unresolved reference: x
|
||||
class C {
|
||||
private val string = getString()
|
||||
|
||||
class object {
|
||||
|
||||
fun getString(): String? {
|
||||
return x()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//file
|
||||
class C {
|
||||
String foo(boolean b) {
|
||||
if (b) {
|
||||
return "abc";
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
fun foo(b: Boolean): String? {
|
||||
if (b) {
|
||||
return "abc"
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//file
|
||||
interface Getter {
|
||||
String get();
|
||||
}
|
||||
|
||||
class C {
|
||||
String foo(boolean b) {
|
||||
Getter getter = new Getter() {
|
||||
@Override
|
||||
public String get() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// ERROR: Return type of 'get' is not a subtype of the return type of overridden member public abstract fun get(): kotlin.String defined in Getter
|
||||
trait Getter {
|
||||
public fun get(): String
|
||||
}
|
||||
|
||||
class C {
|
||||
fun foo(b: Boolean): String {
|
||||
val getter = object : Getter {
|
||||
override fun get(): String? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
String foo() {
|
||||
class Local {
|
||||
String foo() { return null; }
|
||||
}
|
||||
new Local().foo();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class C {
|
||||
fun foo(): String {
|
||||
class Local {
|
||||
fun foo(): String? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Local().foo()
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//file
|
||||
class C {
|
||||
String foo(boolean b) {
|
||||
return b ? "abc" : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
fun foo(b: Boolean): String? {
|
||||
return if (b) "abc" else null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
//file
|
||||
class A {
|
||||
int field = foo();
|
||||
|
||||
@Nullable int foo() { return 1; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
var field = foo()
|
||||
|
||||
fun foo(): Int {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//file
|
||||
class C {
|
||||
String getString(boolean b) {
|
||||
return b ? "a" : null;
|
||||
}
|
||||
|
||||
int foo() {
|
||||
return getString(true).length();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
fun getString(b: Boolean): String? {
|
||||
return if (b) "a" else null
|
||||
}
|
||||
|
||||
fun foo(): Int {
|
||||
return getString(true)!!.length()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//method
|
||||
int foo(String s, boolean b) {
|
||||
if (s == null) System.out.println("null")
|
||||
if (b) return s.length();
|
||||
return 10;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(s: String?, b: Boolean): Int {
|
||||
if (s == null) System.out.println("null")
|
||||
if (b) return s!!.length()
|
||||
return 10
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
class A extends B {
|
||||
public void foo(String s) {}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
public void foo(String s) {}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// ERROR: There's a cycle in the inheritance hierarchy for this type
|
||||
// ERROR: There's a cycle in the inheritance hierarchy for this type
|
||||
open class A : B() {
|
||||
public open fun foo(s: String) {
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
public open fun foo(s: String) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//file
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Base {
|
||||
@Nullable
|
||||
public String foo(@Nullable String s) { return ""; }
|
||||
|
||||
public String bar(String s) {
|
||||
return s != null ? s + 1 : null;
|
||||
}
|
||||
|
||||
public String zoo(Object o){ return ""; }
|
||||
}
|
||||
|
||||
interface I {
|
||||
@Nullable String zoo(@Nullable Object o);
|
||||
}
|
||||
|
||||
class C extends Base implements I {
|
||||
public String foo(String s) { return ""; }
|
||||
|
||||
public String bar(String s) { return ""; }
|
||||
|
||||
public String zoo(Object o) { return ""; }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
open class Base {
|
||||
public open fun foo(s: String?): String? {
|
||||
return ""
|
||||
}
|
||||
|
||||
public open fun bar(s: String?): String? {
|
||||
return if (s != null) s + 1 else null
|
||||
}
|
||||
|
||||
public open fun zoo(o: Any): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
trait I {
|
||||
public fun zoo(o: Any?): String?
|
||||
}
|
||||
|
||||
class C : Base(), I {
|
||||
override fun foo(s: String?): String? {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun bar(s: String?): String? {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun zoo(o: Any?): String? {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//method
|
||||
void foo(String s) {
|
||||
if (s != null) {
|
||||
zoo(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(s: String?) {
|
||||
if (s != null) {
|
||||
zoo(s)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//method
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
void foo(boolean b) {
|
||||
String s = "abc";
|
||||
if (b) {
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun foo(b: Boolean) {
|
||||
var s: String? = "abc"
|
||||
if (b) {
|
||||
s = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//method
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
void foo() {
|
||||
String s = bar();
|
||||
if (s != null) {
|
||||
zoo(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun foo() {
|
||||
val s: String? = bar()
|
||||
if (s != null) {
|
||||
zoo(s)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//method
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
void foo(boolean b) {
|
||||
String s = null;
|
||||
if (b) {
|
||||
s = "abc";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun foo(b: Boolean) {
|
||||
var s: String? = null
|
||||
if (b) {
|
||||
s = "abc"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//method
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
void foo(boolean b) {
|
||||
String s = (b ? "abc" : null);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun foo(b: Boolean) {
|
||||
val s: String? = (if (b) "abc" else null)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//file
|
||||
class A {
|
||||
int foo(String s) {
|
||||
if (s != null) {
|
||||
return s.length();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
fun foo(s: String?): Int {
|
||||
if (s != null) {
|
||||
return s.length()
|
||||
}
|
||||
return -1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user