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,6 @@
|
||||
//file
|
||||
class Test {
|
||||
public static int foo(String[] args) {
|
||||
return args.length;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
class object {
|
||||
public fun foo(args: Array<String>): Int {
|
||||
return args.size
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//file
|
||||
// This is an end-of-line comment
|
||||
|
||||
/*
|
||||
This is a block comment
|
||||
*/
|
||||
|
||||
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
class C {
|
||||
// This is a class comment
|
||||
|
||||
/**
|
||||
* This is a field doc comment.
|
||||
*/
|
||||
private int i;
|
||||
|
||||
/**
|
||||
* This is a function doc comment.
|
||||
*/
|
||||
public void foo() {
|
||||
/* This is a function comment */
|
||||
}
|
||||
|
||||
//simple one line comment for function
|
||||
void f1() {
|
||||
}
|
||||
|
||||
//simple one line comment for field
|
||||
int j;
|
||||
|
||||
//double c style
|
||||
//comment before function
|
||||
void f2() {
|
||||
}
|
||||
|
||||
//double c style
|
||||
//comment before field
|
||||
int k;
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
void f3() {}
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
int l;
|
||||
|
||||
/*two*/ /*comments*//*line*/
|
||||
int z;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// This is an end-of-line comment
|
||||
|
||||
/*
|
||||
This is a block comment
|
||||
*/
|
||||
|
||||
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
class C {
|
||||
// This is a class comment
|
||||
|
||||
/**
|
||||
* This is a field doc comment.
|
||||
*/
|
||||
private val i: Int = 0
|
||||
|
||||
/**
|
||||
* This is a function doc comment.
|
||||
*/
|
||||
public fun foo() {
|
||||
/* This is a function comment */
|
||||
}
|
||||
|
||||
//simple one line comment for function
|
||||
fun f1() {
|
||||
}
|
||||
|
||||
//simple one line comment for field
|
||||
var j: Int = 0
|
||||
|
||||
//double c style
|
||||
//comment before function
|
||||
fun f2() {
|
||||
}
|
||||
|
||||
//double c style
|
||||
//comment before field
|
||||
var k: Int = 0
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
fun f3() {
|
||||
}
|
||||
|
||||
//combination
|
||||
/** of
|
||||
*/
|
||||
//
|
||||
/**
|
||||
* different
|
||||
*/
|
||||
//comments
|
||||
var l: Int = 0
|
||||
|
||||
/*two*/ /*comments*//*line*/
|
||||
var z: Int = 0
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//file
|
||||
class Outer {
|
||||
public static Object o = new Object();
|
||||
|
||||
public static class Nested {
|
||||
public void foo() {
|
||||
o = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Outer {
|
||||
|
||||
public class Nested {
|
||||
public fun foo() {
|
||||
o = null
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
public var o: Any? = Object()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class C {
|
||||
private final int i;
|
||||
public C(int i) {
|
||||
this.i = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package demo
|
||||
|
||||
class C(private val i: Int)
|
||||
@@ -0,0 +1,19 @@
|
||||
//file
|
||||
import java.util.HashMap;
|
||||
|
||||
class G <T extends String> {
|
||||
public <T> G(T t) {
|
||||
}
|
||||
}
|
||||
|
||||
public class Java {
|
||||
void test() {
|
||||
HashMap m = new HashMap();
|
||||
m.put(1, 1);
|
||||
}
|
||||
void test2() {
|
||||
HashMap<?, ?> m = new HashMap();
|
||||
G g = new G("");
|
||||
G<String> g2 = new G<String>("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter K in constructor HashMap<K, V>() Please specify it explicitly.
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter K in constructor HashMap<K, V>() Please specify it explicitly.
|
||||
import java.util.HashMap
|
||||
|
||||
class G<T : String>(t: T)
|
||||
|
||||
public class Java {
|
||||
fun test() {
|
||||
val m = HashMap()
|
||||
m.put(1, 1)
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val m = HashMap()
|
||||
val g = G("")
|
||||
val g2 = G("")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
static void subListRangeCheck(int fromIndex, int toIndex, int size) {
|
||||
if (fromIndex < 0)
|
||||
throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
|
||||
if (toIndex > size)
|
||||
throw new IndexOutOfBoundsException("toIndex = " + toIndex);
|
||||
if (fromIndex > toIndex)
|
||||
throw new IllegalArgumentException("fromIndex(" + fromIndex
|
||||
+ ") > toIndex(" + toIndex + ")");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
class object {
|
||||
fun subListRangeCheck(fromIndex: Int, toIndex: Int, size: Int) {
|
||||
if (fromIndex < 0)
|
||||
throw IndexOutOfBoundsException("fromIndex = " + fromIndex)
|
||||
if (toIndex > size)
|
||||
throw IndexOutOfBoundsException("toIndex = " + toIndex)
|
||||
if (fromIndex > toIndex)
|
||||
throw IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.List;
|
||||
|
||||
class X {
|
||||
private final List<Y> list;
|
||||
|
||||
X(List<Y> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
class Y{}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class X(private val list: List<X.Y>) {
|
||||
|
||||
inner class Y
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Base {
|
||||
class Nested{}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
Nested field;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class Base {
|
||||
inner class Nested
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
var field: Base.Nested
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
void putInt(Integer i) {}
|
||||
|
||||
void test() {
|
||||
byte b = 10;
|
||||
putInt(b);
|
||||
|
||||
Byte b2 = 10;
|
||||
putInt(b2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun putInt(i: Int?) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = 10
|
||||
putInt(b.toInt())
|
||||
|
||||
val b2 = 10
|
||||
putInt(b2.toInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
void putInt(Integer i) {}
|
||||
|
||||
void test() {
|
||||
int i = 10;
|
||||
putInt(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun putInt(i: Int?) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val i = 10
|
||||
putInt(i)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
void putInt(int i) {}
|
||||
|
||||
void test() {
|
||||
byte b = 10;
|
||||
putInt(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun putInt(i: Int) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = 10
|
||||
putInt(b.toInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//file
|
||||
public class Identifier<T> {
|
||||
private final T myName;
|
||||
private boolean myHasDollar;
|
||||
private boolean myNullable = true;
|
||||
|
||||
public Identifier(T name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public Identifier(T name, boolean isNullable) {
|
||||
myName = name;
|
||||
myNullable = isNullable;
|
||||
}
|
||||
|
||||
public Identifier(T name, boolean hasDollar, boolean isNullable) {
|
||||
myName = name;
|
||||
myHasDollar = hasDollar;
|
||||
myNullable = isNullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getName() {
|
||||
return myName;
|
||||
}
|
||||
}
|
||||
|
||||
public class User {
|
||||
public static void main(String[] args) {
|
||||
Identifier<?> i1 = new Identifier<String>("name", false, true);
|
||||
Identifier i2 = new Identifier<String>("name", false);
|
||||
Identifier i3 = new Identifier<String>("name");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// ERROR: 'public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T>' is already defined in root package
|
||||
// ERROR: 'public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean)' is already defined in root package
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
// ERROR: Overload resolution ambiguity: public fun <T> Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier<kotlin.String> defined in root package public constructor Identifier<T>(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
|
||||
public fun <T> Identifier(name: T): Identifier<T> {
|
||||
return Identifier(name, false)
|
||||
}
|
||||
|
||||
public fun <T> Identifier(name: T, isNullable: Boolean): Identifier<T> {
|
||||
val __ = Identifier(name, false)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public fun <T> Identifier(name: T, hasDollar: Boolean, isNullable: Boolean): Identifier<T> {
|
||||
val __ = Identifier(name, hasDollar)
|
||||
__.myNullable = isNullable
|
||||
return __
|
||||
}
|
||||
|
||||
public class Identifier<T>(public val name: T, private val myHasDollar: Boolean) {
|
||||
private var myNullable = true
|
||||
}
|
||||
|
||||
public class User {
|
||||
class object {
|
||||
public fun main(args: Array<String>) {
|
||||
val i1 = Identifier("name", false, true)
|
||||
val i2 = Identifier<String>("name", false)
|
||||
val i3 = Identifier("name")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = User.main(args)
|
||||
@@ -0,0 +1,36 @@
|
||||
//file
|
||||
package test;
|
||||
|
||||
class Base {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Base {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
open class Base {
|
||||
override fun hashCode(): Int {
|
||||
return super.hashCode()
|
||||
}
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
return super.equals(o)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return super.toString()
|
||||
}
|
||||
}
|
||||
|
||||
class Child : Base() {
|
||||
override fun hashCode(): Int {
|
||||
return super.hashCode()
|
||||
}
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
return super.equals(o)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return super.toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
Test(Integer i) {
|
||||
}
|
||||
|
||||
void test() {
|
||||
int i = 10;
|
||||
new Test(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package demo
|
||||
|
||||
class Test(i: Int?) {
|
||||
|
||||
fun test() {
|
||||
val i = 10
|
||||
Test(i)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
Test(int i) {
|
||||
}
|
||||
|
||||
void test() {
|
||||
byte b = 10;
|
||||
new Test(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package demo
|
||||
|
||||
class Test(i: Int) {
|
||||
|
||||
fun test() {
|
||||
val b = 10
|
||||
Test(b.toInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
Integer getInteger(Integer i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
void test() {
|
||||
int i = getInteger(10);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun getInteger(i: Int?): Int? {
|
||||
return i
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val i = getInteger(10)!!
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//file
|
||||
class Test {
|
||||
int getInt() {
|
||||
byte b = 10;
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
fun getInt(): Int {
|
||||
val b = 10
|
||||
return b.toInt()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.io.*;
|
||||
|
||||
class FileRead {
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
FileInputStream fstream = new FileInputStream();
|
||||
DataInputStream in = new DataInputStream(fstream);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
String strLine;
|
||||
while ((strLine = br.readLine()) != null) { System.out.println (strLine); }
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: public constructor FileInputStream(p0: kotlin.String!) defined in java.io.FileInputStream public constructor FileInputStream(p0: java.io.File!) defined in java.io.FileInputStream public constructor FileInputStream(p0: [ERROR : Unresolved java classifier: FileDescriptor]!) defined in java.io.FileInputStream
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: public constructor InputStreamReader(p0: java.io.InputStream!) defined in java.io.InputStreamReader public constructor InputStreamReader(p0: java.io.InputStream!, p1: kotlin.String!) defined in java.io.InputStreamReader public constructor InputStreamReader(p0: java.io.InputStream!, p1: java.nio.charset.Charset!) defined in java.io.InputStreamReader public constructor InputStreamReader(p0: java.io.InputStream!, p1: [ERROR : Unresolved java classifier: CharsetDecoder]!) defined in java.io.InputStreamReader
|
||||
// ERROR: Assignments are not expressions, and only expressions are allowed in this context
|
||||
// ERROR: Unresolved reference: close
|
||||
import java.io.*
|
||||
|
||||
class FileRead {
|
||||
class object {
|
||||
public fun main(args: Array<String>) {
|
||||
try {
|
||||
val fstream = FileInputStream()
|
||||
val `in` = DataInputStream(fstream)
|
||||
val br = BufferedReader(InputStreamReader(`in`))
|
||||
val strLine: String
|
||||
while ((strLine = br.readLine()) != null) {
|
||||
System.out.println(strLine)
|
||||
}
|
||||
`in`.close()
|
||||
} catch (e: Exception) {
|
||||
System.err.println("Error: " + e.getMessage())
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = FileRead.main(args)
|
||||
@@ -0,0 +1,22 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Container {
|
||||
String myString = "1";
|
||||
}
|
||||
|
||||
class One {
|
||||
static Container myContainer = new Container();
|
||||
}
|
||||
|
||||
class StringContainer {
|
||||
StringContainer(String s) {}
|
||||
}
|
||||
|
||||
class Test {
|
||||
void putString(String s) { }
|
||||
void test() {
|
||||
putString(One.myContainer.myString);
|
||||
new StringContainer(One.myContainer.myString);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package demo
|
||||
|
||||
class Container {
|
||||
var myString = "1"
|
||||
}
|
||||
|
||||
class One {
|
||||
class object {
|
||||
var myContainer = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class StringContainer(s: String)
|
||||
|
||||
class Test {
|
||||
fun putString(s: String) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
putString(One.myContainer.myString)
|
||||
StringContainer(One.myContainer.myString)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Container {
|
||||
int myInt = 1;
|
||||
}
|
||||
|
||||
class One {
|
||||
static Container myContainer = new Container();
|
||||
}
|
||||
|
||||
class IntContainer {
|
||||
IntContainer(int i) {}
|
||||
}
|
||||
|
||||
class Test {
|
||||
void putInt(int i) { }
|
||||
void test() {
|
||||
putInt(One.myContainer.myInt);
|
||||
new IntContainer(One.myContainer.myInt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package demo
|
||||
|
||||
class Container {
|
||||
var myInt = 1
|
||||
}
|
||||
|
||||
class One {
|
||||
class object {
|
||||
var myContainer = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class IntContainer(i: Int)
|
||||
|
||||
class Test {
|
||||
fun putInt(i: Int) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
putInt(One.myContainer.myInt)
|
||||
IntContainer(One.myContainer.myInt)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Container {
|
||||
int myInt = 1;
|
||||
}
|
||||
|
||||
class One {
|
||||
static Container myContainer = new Container();
|
||||
}
|
||||
|
||||
class Test {
|
||||
byte b = One.myContainer.myInt;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package demo
|
||||
|
||||
class Container {
|
||||
var myInt = 1
|
||||
}
|
||||
|
||||
class One {
|
||||
class object {
|
||||
var myContainer = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
var b = One.myContainer.myInt.toByte()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//file
|
||||
class Test {
|
||||
public static String toFileSystemSafeName(String name) {
|
||||
int size = name.length();
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
class object {
|
||||
public fun toFileSystemSafeName(name: String): String {
|
||||
val size = name.length()
|
||||
return name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Container {
|
||||
int myInt = 1;
|
||||
}
|
||||
|
||||
class One {
|
||||
static Container myContainer = new Container();
|
||||
}
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
byte b = One.myContainer.myInt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package demo
|
||||
|
||||
class Container {
|
||||
var myInt = 1
|
||||
}
|
||||
|
||||
class One {
|
||||
class object {
|
||||
var myContainer = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
val b = One.myContainer.myInt.toByte()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//file
|
||||
package test;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* User: ignatov
|
||||
*/
|
||||
public class Test {
|
||||
public static boolean isDir(File parent) {
|
||||
if (parent == null || !parent.exists()) {
|
||||
return false;
|
||||
}
|
||||
boolean result = true;
|
||||
if (parent.isDirectory()) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* User: ignatov
|
||||
*/
|
||||
public class Test {
|
||||
class object {
|
||||
public fun isDir(parent: File?): Boolean {
|
||||
if (parent == null || !parent.exists()) {
|
||||
return false
|
||||
}
|
||||
val result = true
|
||||
if (parent.isDirectory()) {
|
||||
return true
|
||||
} else
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Container {
|
||||
boolean myBoolean = true;
|
||||
}
|
||||
|
||||
class One {
|
||||
static Container myContainer = new Container();
|
||||
}
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
if (One.myContainer.myBoolean)
|
||||
System.out.println("Ok");
|
||||
|
||||
String s = One.myContainer.myBoolean ? "YES" : "NO";
|
||||
|
||||
while (One.myContainer.myBoolean)
|
||||
System.out.println("Ok");
|
||||
|
||||
do {
|
||||
System.out.println("Ok");
|
||||
} while (One.myContainer.myBoolean)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package demo
|
||||
|
||||
class Container {
|
||||
var myBoolean = true
|
||||
}
|
||||
|
||||
class One {
|
||||
class object {
|
||||
var myContainer = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
if (One.myContainer.myBoolean)
|
||||
System.out.println("Ok")
|
||||
|
||||
val s = if (One.myContainer.myBoolean) "YES" else "NO"
|
||||
|
||||
while (One.myContainer.myBoolean)
|
||||
System.out.println("Ok")
|
||||
|
||||
do {
|
||||
System.out.println("Ok")
|
||||
} while (One.myContainer.myBoolean)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//file
|
||||
class Test {
|
||||
void test() {
|
||||
boolean res = true;
|
||||
res &= false;
|
||||
res |= false;
|
||||
res ^= false;
|
||||
System.out.println(true & false);
|
||||
System.out.println(true | false);
|
||||
System.out.println(true ^ false);
|
||||
System.out.println(!true);
|
||||
|
||||
System.out.println(true && false);
|
||||
System.out.println(true || false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Test {
|
||||
fun test() {
|
||||
var res = true
|
||||
res = res and false
|
||||
res = res or false
|
||||
res = res xor false
|
||||
System.out.println(true and false)
|
||||
System.out.println(true or false)
|
||||
System.out.println(true xor false)
|
||||
System.out.println(!true)
|
||||
|
||||
System.out.println(true && false)
|
||||
System.out.println(true || false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//file
|
||||
package com.voltvoodoo.saplo4j.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Language implements Serializable {
|
||||
protected String code;
|
||||
|
||||
public Language(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Base {
|
||||
void test() {}
|
||||
String toString() {
|
||||
return "BASE";
|
||||
}
|
||||
}
|
||||
|
||||
class Child extends Base {
|
||||
void test() {}
|
||||
String toString() {
|
||||
return "Child";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.voltvoodoo.saplo4j.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
public class Language(protected var code: String) : Serializable {
|
||||
|
||||
override fun toString(): String {
|
||||
return this.code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class Base {
|
||||
open fun test() {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "BASE"
|
||||
}
|
||||
}
|
||||
|
||||
class Child : Base() {
|
||||
override fun test() {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Child"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//file
|
||||
package com.voltvoodoo.saplo4j.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Language implements Serializable {
|
||||
public static Language ENGLISH = new Language("en");
|
||||
public static Language SWEDISH = new Language("sv");
|
||||
|
||||
protected String code;
|
||||
private static final long serialVersionUID = -2442762969929206780L;
|
||||
|
||||
public Language(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public boolean equals(Language other) {
|
||||
return other.toString().equals(this.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.voltvoodoo.saplo4j.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
public class Language(protected var code: String) : Serializable {
|
||||
|
||||
public fun equals(other: Language): Boolean {
|
||||
return other.toString() == this.toString()
|
||||
}
|
||||
|
||||
class object {
|
||||
public var ENGLISH: Language = Language("en")
|
||||
public var SWEDISH: Language = Language("sv")
|
||||
private val serialVersionUID = -2442762969929206780
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//file
|
||||
class Test {
|
||||
void putInt(int i) {}
|
||||
|
||||
void test() {
|
||||
Byte b = 10;
|
||||
putInt(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
fun putInt(i: Int) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = 10
|
||||
putInt(b.toInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
String test() {
|
||||
String s1 = "";
|
||||
String s2 = "";
|
||||
String s3 = "";
|
||||
if (s1.isEmpty() && s2.isEmpty())
|
||||
return "OK";
|
||||
|
||||
if (s1.isEmpty() && s2.isEmpty() && s3.isEmpty())
|
||||
return "OOOK";
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun test(): String {
|
||||
val s1 = ""
|
||||
val s2 = ""
|
||||
val s3 = ""
|
||||
if (s1.isEmpty() && s2.isEmpty())
|
||||
return "OK"
|
||||
|
||||
if (s1.isEmpty() && s2.isEmpty() && s3.isEmpty())
|
||||
return "OOOK"
|
||||
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Program {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Halo!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package demo
|
||||
|
||||
class Program {
|
||||
class object {
|
||||
public fun main(args: Array<String>) {
|
||||
System.out.println("Halo!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = Program.main(args)
|
||||
@@ -0,0 +1,17 @@
|
||||
//file
|
||||
class Test {
|
||||
public static int getInt(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
class object {
|
||||
public fun getInt(i: Int): Int {
|
||||
when (i) {
|
||||
0 -> return 0
|
||||
1 -> return 1
|
||||
2 -> return 2
|
||||
3 -> return 3
|
||||
else -> return -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
for(int i = 0; i < 10; ++i) {
|
||||
System.out.println(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package demo
|
||||
|
||||
class Test {
|
||||
fun test() {
|
||||
for (i in 0..10 - 1) {
|
||||
System.out.println(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//file
|
||||
class Test {
|
||||
public void printNumbers(int number) {
|
||||
for(int i = 2; i < Math.sqrt(number) + 1; i++)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public fun printNumbers(number: Int) {
|
||||
for (i in 2..Math.sqrt(number.toDouble()) + 1 - 1)
|
||||
System.out.println(i)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//file
|
||||
package demo;
|
||||
|
||||
class C {
|
||||
public C(int a) {
|
||||
abc = a * 2;
|
||||
}
|
||||
int abc = 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// ERROR: Variable cannot be initialized before declaration
|
||||
package demo
|
||||
|
||||
class C(a: Int) {
|
||||
{
|
||||
abc = a * 2
|
||||
}
|
||||
var abc = 0
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//file
|
||||
import java.util.Calendar
|
||||
|
||||
abstract class MyCalendar extends Calendar {
|
||||
public void foo() {
|
||||
int i = ALL_STYLES;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.Calendar
|
||||
|
||||
abstract class MyCalendar : Calendar() {
|
||||
public fun foo() {
|
||||
val i = Calendar.ALL_STYLES
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
//file
|
||||
import java.util.*
|
||||
|
||||
class A {
|
||||
List<String> list = new ArrayList<String>();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import java.util.*
|
||||
|
||||
class A {
|
||||
var list: List<String> = ArrayList()
|
||||
}
|
||||
Reference in New Issue
Block a user