New J2K: Split old j2k and new j2k tests
This commit is contained in:
committed by
Ilya Kirillov
parent
02a206bf7c
commit
b411e8e18e
-6
@@ -1,6 +0,0 @@
|
||||
internal annotation class A
|
||||
|
||||
internal annotation class B
|
||||
|
||||
class U(@field:B @param:A
|
||||
var i: Int)
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// 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() {
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
internal annotation class An(val value: String)
|
||||
|
||||
|
||||
class Test {
|
||||
@get:An(value = "get")
|
||||
@set:An(value = "set")
|
||||
var id = 0
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// !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()
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
class WithModifiersOnAccessors {
|
||||
|
||||
@get:Synchronized
|
||||
@set:Synchronized
|
||||
var sync = 0
|
||||
|
||||
@get:Strictfp
|
||||
val strict = 0.0
|
||||
|
||||
@Synchronized
|
||||
private fun methSync() {
|
||||
}
|
||||
|
||||
@Strictfp
|
||||
protected fun methStrict() {
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
internal class Test {
|
||||
var str: String? = null
|
||||
|
||||
init {
|
||||
str = "Ola"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
class Test {
|
||||
fun someMethod() {
|
||||
val someRunnable: Runnable = object : Runnable {
|
||||
override fun run() {
|
||||
this.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
val a: Array<Double?> = arrayOf(1.0, 2.0, 3.0)
|
||||
-1
@@ -1 +0,0 @@
|
||||
val a: Array<Float?> = arrayOf(1.0f, 2f, 3f)
|
||||
-1
@@ -1 +0,0 @@
|
||||
val a: Array<Any?> = arrayOfNulls(10)
|
||||
@@ -1 +0,0 @@
|
||||
val d2: Array<IntArray?> = arrayOf()
|
||||
-1
@@ -1 +0,0 @@
|
||||
val d2: Array<IntArray?> = arrayOfNulls(5)
|
||||
-1
@@ -1 +0,0 @@
|
||||
val d3 = Array<Array<IntArray>>(5) { arrayOfNulls(5) }
|
||||
@@ -1 +0,0 @@
|
||||
val ss = Array<Array<String>>(5) { arrayOfNulls(5) }
|
||||
@@ -1 +0,0 @@
|
||||
val sss = Array(5) { Array<Array<String>>(5) { arrayOfNulls(5) } }
|
||||
@@ -1 +0,0 @@
|
||||
fun fromArrayToCollection(a: Array<Foo?>?) {}
|
||||
@@ -1 +0,0 @@
|
||||
val a: Array<String?> = arrayOf("abc")
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
String x = "nya"
|
||||
assert true : "string details:" + x;
|
||||
@@ -1,2 +1 @@
|
||||
val x = "nya"
|
||||
assert(true) { "string details:$x" }
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x &= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x and 2
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
class AssignmentAsExpression {
|
||||
private var field = 0
|
||||
private var field2 = 0
|
||||
|
||||
fun assign(value: Int) {
|
||||
field = value
|
||||
val v = field
|
||||
field2 = value
|
||||
field = field2
|
||||
val j: Int
|
||||
j = 0
|
||||
val i = j
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
5 shl 16 or (0 shr 8 or 1)
|
||||
-1
@@ -1 +0,0 @@
|
||||
5 /*operand '5'*/ shl /*left shift*/ 16 /*operand '16'*/ or ( /*or*/ 1 /*operand '1'*/ shr /*right shift*/ 8 /*operand '8'*/ or /*or*/ 0) /*operand '0'*/ /*post comment*/
|
||||
@@ -1,10 +0,0 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
|
||||
internal class Foo {
|
||||
fun foo(o: HashSet<*>) {
|
||||
val o2: HashSet<*> = o
|
||||
var foo: Int = 0
|
||||
foo = o2.size
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x |= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x or 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x <<= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x shl 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x >>= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x shr 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x >>>= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x ushr 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x ^= 2
|
||||
@@ -1,2 +1 @@
|
||||
var x = 0
|
||||
x = x xor 2
|
||||
+2
-3
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 2;
|
||||
x & 2;
|
||||
//expression
|
||||
x & 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 2
|
||||
x and 2
|
||||
+2
-3
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x | 2;
|
||||
//expression
|
||||
x | 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 0
|
||||
x or 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x << 2;
|
||||
//expression
|
||||
x << 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 0
|
||||
x shl 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x >> 2;
|
||||
//expression
|
||||
x >> 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 0
|
||||
x shr 2
|
||||
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x >>> 2;
|
||||
//expression
|
||||
x >>> 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 0
|
||||
x.ushr(2)
|
||||
@@ -1,2 +0,0 @@
|
||||
val x = 0
|
||||
x ushr 2
|
||||
+2
-3
@@ -1,3 +1,2 @@
|
||||
//statement
|
||||
int x = 0;
|
||||
x ^ 2;
|
||||
//expression
|
||||
x ^ 2
|
||||
@@ -1,2 +1 @@
|
||||
val x = 0
|
||||
x xor 2
|
||||
@@ -1,5 +1,4 @@
|
||||
//method
|
||||
void bar(int a) {}
|
||||
void foo() {
|
||||
{
|
||||
int a = 1;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
fun bar(a: Int) {}
|
||||
fun foo() {
|
||||
run {
|
||||
val a = 1
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
internal class Boxing {
|
||||
fun test() {
|
||||
var i: Int? = 0
|
||||
val n: Number = 0.0f
|
||||
i = 1
|
||||
var j = i
|
||||
val k = i + 2
|
||||
i = null
|
||||
j = i!!
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
//statement
|
||||
Boolean i = false;
|
||||
Boolean i = 10;
|
||||
+1
-1
@@ -1 +1 @@
|
||||
val i = false
|
||||
val i = 10
|
||||
@@ -1 +0,0 @@
|
||||
val i: Byte = 10
|
||||
@@ -1 +0,0 @@
|
||||
val i = 10.toChar()
|
||||
@@ -1 +0,0 @@
|
||||
val i = 10.0
|
||||
@@ -1 +0,0 @@
|
||||
val i = 10f
|
||||
@@ -1 +0,0 @@
|
||||
val i: Long = 10
|
||||
@@ -1 +0,0 @@
|
||||
val i: Any = 10
|
||||
@@ -1 +0,0 @@
|
||||
val i: Short = 10
|
||||
@@ -1,12 +0,0 @@
|
||||
import java.io.PrintStream
|
||||
|
||||
internal object Library {
|
||||
val ourOut: PrintStream? = null
|
||||
}
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
|
||||
Library.ourOut!!.print(1)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
internal object Library {
|
||||
fun call() {}
|
||||
|
||||
val string: String
|
||||
get() = ""
|
||||
|
||||
}
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
Library.call()
|
||||
Library.string.isEmpty()
|
||||
}
|
||||
}
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
internal class Library {
|
||||
fun call() {}
|
||||
|
||||
val string: String
|
||||
get() = ""
|
||||
}
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
val lib: Library = Library()
|
||||
lib.call()
|
||||
lib.string.isEmpty()
|
||||
|
||||
Library().call()
|
||||
Library().string.isEmpty()
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
internal class Library {
|
||||
fun call() {}
|
||||
|
||||
val string: String
|
||||
get() = ""
|
||||
|
||||
}
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
val lib = Library()
|
||||
lib.call()
|
||||
lib.string.isEmpty()
|
||||
|
||||
Library().call()
|
||||
Library().string.isEmpty()
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package test
|
||||
|
||||
class Short(s: String?) {
|
||||
companion object {
|
||||
fun valueOf(value: String): Short {
|
||||
return Short(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal object Test {
|
||||
fun test() {
|
||||
Short.valueOf("1")
|
||||
test.Short.valueOf("1")
|
||||
java.lang.Short.valueOf("1")
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
internal abstract class Shape {
|
||||
var color: String? = null
|
||||
abstract fun area(): Double
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ public class Test {
|
||||
private Listener listener = new Listener() {
|
||||
@Override
|
||||
public void onChange(int visibility) {
|
||||
int a = (visibility & 1)
|
||||
val a = (visibility & 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package test
|
||||
|
||||
import javaApi.Listener
|
||||
|
||||
class Test {
|
||||
private val listener = Listener { visibility -> val a = visibility and 1 }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
internal class T {
|
||||
fun main() {}
|
||||
fun i(): Int {}
|
||||
fun s(): String? {}
|
||||
}
|
||||
+2
-3
@@ -1,3 +1,2 @@
|
||||
interface I {}
|
||||
class Base {}
|
||||
final class A extends Base implements I {}
|
||||
//class
|
||||
final class A extends Base implements I {}
|
||||
+1
-3
@@ -1,3 +1 @@
|
||||
internal interface I
|
||||
internal open class Base
|
||||
internal class A : Base(), I
|
||||
internal class A : Base(), I
|
||||
+1
-4
@@ -1,5 +1,2 @@
|
||||
class Base {}
|
||||
interface I0 {}
|
||||
interface I1 {}
|
||||
interface I2 {}
|
||||
//class
|
||||
final class A extends Base implements I0, I1, I2 {}
|
||||
-4
@@ -1,5 +1 @@
|
||||
internal open class Base
|
||||
internal interface I0
|
||||
internal interface I1
|
||||
internal interface I2
|
||||
internal class A : Base(), I0, I1, I2
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter K in constructor HashMap<K : Any!, V : Any!>(initialCapacity: Int) Please specify it explicitly.
|
||||
// ERROR: Type inference failed: Not enough information to infer parameter K in constructor HashMap<K : Any!, V : Any!>(initialCapacity: Int) Please specify it explicitly.
|
||||
package demo
|
||||
|
||||
internal class Test {
|
||||
constructor() {}
|
||||
constructor(s: String?) {}
|
||||
}
|
||||
|
||||
internal class User {
|
||||
fun main() {
|
||||
val m: HashMap<*, *> = HashMap<Any?, Any?>(1)
|
||||
val m2: HashMap<*, *> = HashMap<Any?, Any?>(10)
|
||||
|
||||
val t1 = Test()
|
||||
val t2 = Test("")
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
internal open class Base {
|
||||
companion object {
|
||||
const val CONSTANT = 10
|
||||
}
|
||||
}
|
||||
|
||||
internal class Derived : Base() {
|
||||
fun foo() {}
|
||||
}
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
class Base {}
|
||||
//class
|
||||
final class A extends Base {}
|
||||
@@ -1,2 +1 @@
|
||||
internal open class Base
|
||||
internal class A : Base()
|
||||
@@ -1,6 +0,0 @@
|
||||
internal object Util {
|
||||
|
||||
const val CONSTANT = 10
|
||||
fun util1() {}
|
||||
fun util2() {}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
internal object Util {
|
||||
|
||||
const val CONSTANT = 10
|
||||
|
||||
fun util1() {}
|
||||
fun util2() {}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
internal object Util {
|
||||
|
||||
const val CONSTANT = 10
|
||||
fun util1() {}
|
||||
fun util2() {}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
internal object Util {
|
||||
const val publicStr = ""
|
||||
internal const val protectedStr = ""
|
||||
const val packageStr = ""
|
||||
private const val privateStr = ""
|
||||
fun publicMethod() {}
|
||||
internal fun protectedMethod() {}
|
||||
fun packageMethod() {}
|
||||
private fun privateMethod() {}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
object Util {
|
||||
const val publicStr = ""
|
||||
internal const val protectedStr = ""
|
||||
internal const val packageStr = ""
|
||||
private const val privateStr = ""
|
||||
|
||||
fun publicMethod() {}
|
||||
internal fun protectedMethod() {}
|
||||
internal fun packageMethod() {}
|
||||
private fun privateMethod() {}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
val constrArgTypes: Array<Class<*>?> = arrayOf(Array<String>::class.java, String::class.java, Int::class.java, Double::class.java)
|
||||
@@ -1,29 +0,0 @@
|
||||
// ERROR: Class 'A' is not abstract and does not implement abstract member public abstract fun run(): Unit defined in java.lang.Runnable
|
||||
package foo
|
||||
|
||||
// we use package 'foo'
|
||||
|
||||
// imports:
|
||||
import java.util.ArrayList
|
||||
|
||||
// we need ArrayList
|
||||
// let's declare a class:
|
||||
internal class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
|
||||
fun foo /* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
// let's print something:
|
||||
println("1") // print 1
|
||||
println("2") // print 2
|
||||
|
||||
println("3") // print 3
|
||||
|
||||
// end of printing
|
||||
|
||||
if (p > 0) { // do this only when p > 0
|
||||
// we print 4 and return
|
||||
println("3")
|
||||
return // do not continue
|
||||
}
|
||||
|
||||
// some code to be added
|
||||
}
|
||||
} // end of class A
|
||||
@@ -1,33 +0,0 @@
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
package foo
|
||||
|
||||
internal class A {
|
||||
private/*it's private*/ val field = 0
|
||||
fun /* nothing to return */ foo(/* no parameters at all */) {
|
||||
// let declare a variable
|
||||
// with 2 comments before
|
||||
val /*int*/ a /* it's a */ = 2 /* it's 2 */ + 1 /* it's 1 */ // variable a declared
|
||||
} // end of foo
|
||||
|
||||
fun /* we return int*/ foo( /*int*/ p: Int/* parameter p */): Int { /* body is empty */
|
||||
}
|
||||
|
||||
/*it's public*/ fun foo(s: String?): Char {}
|
||||
protected/*it's protected*/ fun foo(c: Char) {}
|
||||
/**
|
||||
* Method description.
|
||||
* Multi-line method description.
|
||||
*
|
||||
*
|
||||
* @param param1 param1 description
|
||||
* @param param2 param2 description
|
||||
*
|
||||
* @param param3 param3 description
|
||||
*/
|
||||
fun foo(param1: String?, param2: String?, param3: String?) {}
|
||||
|
||||
companion object {
|
||||
/*it's public*/const /*and static*/ val/*and final*/ C = 1
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
internal class C(val myArg1: Int) {
|
||||
var myArg2: Int
|
||||
var myArg3: Int
|
||||
|
||||
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = arg3
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int) : this(arg1) {
|
||||
myArg2 = arg2
|
||||
myArg3 = 0
|
||||
}
|
||||
|
||||
init {
|
||||
myArg2 = 0
|
||||
myArg3 = 0
|
||||
}
|
||||
}
|
||||
|
||||
object User {
|
||||
fun main() {
|
||||
val c1 = C(100, 100, 100)
|
||||
val c2 = C(100, 100)
|
||||
val c3 = C(100)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
class Test {
|
||||
private val s: String
|
||||
internal var b = false
|
||||
internal var d = 0.0
|
||||
|
||||
constructor() {
|
||||
b = true
|
||||
}
|
||||
|
||||
constructor(s: String) {
|
||||
this.s = s
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ internal class Customer(val firstName: String, val lastName: String) {
|
||||
}
|
||||
|
||||
internal class CustomerBuilder {
|
||||
var _firstName = "Homer"
|
||||
var _firstName = "Homer"
|
||||
var _lastName = "Simpson"
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package org.test.customer
|
||||
|
||||
internal class Customer(val firstName: String, val lastName: String) {
|
||||
init {
|
||||
doSmthBefore()
|
||||
doSmthAfter()
|
||||
}
|
||||
|
||||
private fun doSmthBefore() {}
|
||||
|
||||
private fun doSmthAfter() {}
|
||||
}
|
||||
|
||||
internal class CustomerBuilder {
|
||||
var _firstName = "Homer"
|
||||
var _lastName = "Simpson"
|
||||
fun WithFirstName(firstName: String): CustomerBuilder {
|
||||
_firstName = firstName
|
||||
return this
|
||||
}
|
||||
|
||||
fun WithLastName(lastName: String): CustomerBuilder {
|
||||
_lastName = lastName
|
||||
return this
|
||||
}
|
||||
|
||||
fun Build(): Customer {
|
||||
return Customer(_firstName, _lastName)
|
||||
}
|
||||
}
|
||||
|
||||
object User {
|
||||
fun main() {
|
||||
val customer = CustomerBuilder()
|
||||
.WithFirstName("Homer")
|
||||
.WithLastName("Simpson")
|
||||
.Build()
|
||||
println(customer.firstName)
|
||||
println(customer.lastName)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
internal class C(p: Int, c: C) {
|
||||
var p = 0
|
||||
|
||||
init {
|
||||
c.p = p
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
internal class C(p: Int) {
|
||||
var p: Int
|
||||
|
||||
init {
|
||||
this.p = 0
|
||||
if (p > 0) {
|
||||
this.p = p
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
internal class C(x: String) {
|
||||
var x: Any
|
||||
|
||||
init {
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
internal class C(x: Any?, b: Boolean) {
|
||||
var x: Any? = null
|
||||
|
||||
init {
|
||||
if (b) {
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
internal open class Base(o: Any?, l: Int)
|
||||
|
||||
internal class C(private val string: String) : Base(string, string.length)
|
||||
-1
@@ -1 +0,0 @@
|
||||
internal class C(@Deprecated("") private val p1: Int, private val myP2: Int, @SuppressWarnings("x") var p3: Int)
|
||||
@@ -1,28 +0,0 @@
|
||||
class Identifier<T> {
|
||||
val name: T
|
||||
private var myHasDollar = false
|
||||
private var myNullable = true
|
||||
|
||||
constructor(name: T) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
constructor(name: T, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myNullable = isNullable
|
||||
}
|
||||
|
||||
constructor(name: T, hasDollar: Boolean, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myHasDollar = hasDollar
|
||||
myNullable = isNullable
|
||||
}
|
||||
}
|
||||
|
||||
object User {
|
||||
fun main() {
|
||||
val i1: Identifier<*> = Identifier<String?>("name", false, true)
|
||||
val i2 = Identifier("name", false)
|
||||
val i3 = Identifier("name")
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
class Identifier {
|
||||
val name: String
|
||||
private var myHasDollar = false
|
||||
private var myNullable = true
|
||||
|
||||
constructor(name: String) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
constructor(name: String, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myNullable = isNullable
|
||||
}
|
||||
|
||||
constructor(name: String, hasDollar: Boolean, isNullable: Boolean) {
|
||||
this.name = name
|
||||
myHasDollar = hasDollar
|
||||
myNullable = isNullable
|
||||
}
|
||||
}
|
||||
|
||||
object User {
|
||||
fun main() {
|
||||
val i1 = Identifier("name", false, true)
|
||||
val i2 = Identifier("name", false)
|
||||
val i3 = Identifier("name")
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user