New J2K: Fix existing test data
This commit is contained in:
committed by
Ilya Kirillov
parent
9c71d5ca25
commit
ea2081c2f0
+6
@@ -0,0 +1,6 @@
|
||||
internal annotation class A
|
||||
|
||||
internal annotation class B
|
||||
|
||||
class U(@field:B @param:A
|
||||
var i: Int)
|
||||
@@ -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,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() {
|
||||
}
|
||||
}
|
||||
+8
@@ -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,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()
|
||||
}
|
||||
}
|
||||
+17
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
import java.util.HashSet
|
||||
|
||||
internal class Foo {
|
||||
fun foo(o: HashSet<*>?) {
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// !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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
internal object Util {
|
||||
|
||||
const val CONSTANT = 10
|
||||
|
||||
fun util1() {}
|
||||
fun util2() {}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ internal class C(private val arg1: Int, private val arg2: Int, private val arg3:
|
||||
}
|
||||
|
||||
constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
|
||||
println(foo(1) + foo(2) + other.foo(3) + staticFoo(4) + C.staticFoo(5))
|
||||
println(foo(1) + foo(2) + other.foo(3) + staticFoo(4) + staticFoo(5))
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
internal class C() {
|
||||
|
||||
constructor(p: Int) : this() {
|
||||
println(staticField1 + C.staticField2)
|
||||
println(staticField1 + staticField2)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
internal annotation class TestAnnotation
|
||||
|
||||
class Test(@field:TestAnnotation @set:TestAnnotation @get:TestAnnotation @param:TestAnnotation var arg: String?)
|
||||
+2
-10
@@ -1,10 +1,2 @@
|
||||
open class Base internal constructor(x: Int) {
|
||||
var x = 42
|
||||
protected set
|
||||
|
||||
init {
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
|
||||
internal class Derived(b: Base) : Base(b.x)
|
||||
open class Base internal constructor(val x: Int)
|
||||
internal class Derived(b: Base) : Base(b.x)
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
var x: String? = ""
|
||||
get() {
|
||||
println("getter invoked")
|
||||
return field
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
var x: String? = ""
|
||||
get() {
|
||||
println("getter invoked")
|
||||
return field
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class C {
|
||||
private var myX: String? = ""
|
||||
|
||||
var x: String?
|
||||
get() = myX
|
||||
set(x) {
|
||||
println("setter invoked")
|
||||
myX = x
|
||||
}
|
||||
|
||||
internal fun foo() {
|
||||
myX = "a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class C {
|
||||
private var x: String? = ""
|
||||
|
||||
fun getX(): String? {
|
||||
return x
|
||||
}
|
||||
|
||||
fun setX(x: String?) {
|
||||
println("setter invoked")
|
||||
this.x = x
|
||||
}
|
||||
|
||||
internal fun foo() {
|
||||
x = "a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class C {
|
||||
protected var x: String? = ""
|
||||
|
||||
fun getX(): String? {
|
||||
return x
|
||||
}
|
||||
|
||||
fun setX(x: String?) {
|
||||
println("setter invoked")
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
internal class A {
|
||||
fun foo(p: Boolean) {
|
||||
var i = 1
|
||||
while (i < 1000) {
|
||||
println(i)
|
||||
i *= 2
|
||||
}
|
||||
|
||||
if (p) {
|
||||
val i = 10
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.voltvoodoo.saplo4j.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Language(protected var code: String?) : Serializable {
|
||||
override fun toString(): String {
|
||||
return code
|
||||
}
|
||||
}
|
||||
|
||||
internal open class Base {
|
||||
internal open fun test() {}
|
||||
override fun toString(): String {
|
||||
return "BASE"
|
||||
}
|
||||
}
|
||||
|
||||
internal class Child : Base() {
|
||||
override fun test() {}
|
||||
override fun toString(): String {
|
||||
return "Child"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
internal class Test {
|
||||
fun operationsWithChar() {
|
||||
val c = 1.toChar()
|
||||
val i = 1
|
||||
|
||||
b(i > c.toInt())
|
||||
b(i >= c.toInt())
|
||||
b(i < c.toInt())
|
||||
b(i <= c.toInt())
|
||||
|
||||
b(c.toInt() > i)
|
||||
b(c.toInt() >= i)
|
||||
b(c.toInt() < i)
|
||||
b(c.toInt() <= i)
|
||||
|
||||
b(c.toInt() == i)
|
||||
b(c.toInt() != i)
|
||||
b(i == c.toInt())
|
||||
b(i != c.toInt())
|
||||
|
||||
i(i + c.toInt())
|
||||
i(i - c.toInt())
|
||||
i(i / c.toInt())
|
||||
i(i * c.toInt())
|
||||
i(i % c.toInt())
|
||||
i(i or c.toInt())
|
||||
i(i and c.toInt())
|
||||
i(i shl c.toInt())
|
||||
i(i shr c.toInt())
|
||||
|
||||
i(c.toInt() + i)
|
||||
i(c.toInt() - i)
|
||||
i(c.toInt() / i)
|
||||
i(c.toInt() * i)
|
||||
i(c.toInt() % i)
|
||||
i(c.toInt() or i)
|
||||
i(c.toInt() and i)
|
||||
i(c.toInt() shl i)
|
||||
i(c.toInt() shr i)
|
||||
}
|
||||
|
||||
fun b(b: Boolean) {}
|
||||
fun i(i: Int) {}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlinApi.KotlinClass
|
||||
|
||||
class C {
|
||||
internal fun bar() {
|
||||
println(KotlinClass.CONST)
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlinApi.KotlinClass
|
||||
|
||||
class C {
|
||||
internal fun bar() {
|
||||
println(KotlinClass.CONST)
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import kotlinApi.KotlinClass
|
||||
|
||||
internal class C {
|
||||
fun foo(): Int {
|
||||
return KotlinClass.staticProperty
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import kotlinApi.extensionFunction
|
||||
|
||||
fun adjust(name: String?, maxLen: Int) {
|
||||
(1 + 1).toString()
|
||||
"a".split(("\\s+" + "\\s+").toRegex(), 2).toTypedArray()
|
||||
(1 + 1).extensionFunction()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
internal object X {
|
||||
@Throws(Exception::class)
|
||||
fun <T> foo(constructor: Constructor<T?>, args1: Array<Any?>, args2: Array<Any?>?) {
|
||||
constructor.newInstance(*args1)
|
||||
constructor.newInstance(args1, args2)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import javaApi.WithVarargConstructor
|
||||
|
||||
internal class X {
|
||||
fun foo() {
|
||||
val o1 = WithVarargConstructor(1, *arrayOf("a"))
|
||||
val o2 = WithVarargConstructor(2, arrayOf("a"), arrayOf("b"))
|
||||
val o3 = WithVarargConstructor(2, "a")
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
//method
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
String bar() {
|
||||
return null;
|
||||
}
|
||||
void foo() {
|
||||
String s = bar();
|
||||
if (s != null) {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun bar(): String? {
|
||||
return null
|
||||
}
|
||||
fun foo() {
|
||||
val s: String? = bar()
|
||||
if (s != null) {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// ERROR: Type mismatch: inferred type is Any? but Any was expected
|
||||
// ERROR: Type mismatch: inferred type is Any? but Any was expected
|
||||
internal class A {
|
||||
@JvmOverloads
|
||||
fun foo(s: String? = null): Any {
|
||||
println("s = $s")
|
||||
return ""
|
||||
}
|
||||
|
||||
fun bar(s: String?): Any? {
|
||||
println("s = $s")
|
||||
return if (s == null) "" else null
|
||||
}
|
||||
|
||||
fun bar(): Any {
|
||||
return bar(null)
|
||||
}
|
||||
|
||||
fun bar1(s: String?): Any? {
|
||||
println("s = $s")
|
||||
return if (s == null) "" else null
|
||||
}
|
||||
|
||||
fun bar1(): Any {
|
||||
return bar1(null)
|
||||
}
|
||||
|
||||
@Deprecated("")
|
||||
fun f() {
|
||||
f(1)
|
||||
}
|
||||
|
||||
fun f(p: Int) {
|
||||
println("p = $p")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
internal class C {
|
||||
fun foo(o: Any?) {
|
||||
if (o is String) {
|
||||
val l = o.length
|
||||
val substring = o.substring(l - 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package test
|
||||
|
||||
class BaseProtectedConstructor {
|
||||
fun usageInConstructor() {
|
||||
|
||||
}
|
||||
|
||||
fun usageInPropertyInitializer(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
fun usageInStaticInit() {
|
||||
|
||||
}
|
||||
|
||||
fun usageInMethod() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal class DerivedSamePackage {
|
||||
|
||||
private val i = BaseProtectedConstructor().usageInPropertyInitializer()
|
||||
|
||||
init {
|
||||
BaseProtectedConstructor().usageInConstructor()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
init {
|
||||
BaseProtectedConstructor().usageInStaticInit()
|
||||
}
|
||||
}
|
||||
|
||||
fun usage() {
|
||||
BaseProtectedConstructor().usageInMethod()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
internal enum class ColorEnum {
|
||||
GREEN
|
||||
}
|
||||
|
||||
internal class MyClass {
|
||||
fun method(colorEnum: ColorEnum?): Int {
|
||||
return when (colorEnum) {
|
||||
ColorEnum.GREEN -> 1
|
||||
else -> 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.Arrays
|
||||
|
||||
class Foo {
|
||||
fun test() {
|
||||
val list: List<String?> = Arrays.asList("a", "b")
|
||||
val array1: Array<Any?> = list.toTypedArray()
|
||||
val array2: Array<Any?> = list.toTypedArray()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package demo
|
||||
|
||||
class TestJava {
|
||||
fun f(result: Function1<String?, Unit?>) {
|
||||
result.invoke("a")
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val x: List<String?> = ArrayList()
|
||||
x.filter { o: String? -> o == "a" }
|
||||
val lazy: Lazy<String?> = lazy(LazyThreadSafetyMode.NONE) { "aaa" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// ERROR: Null can not be a value of a non-null type Iterator<String?>
|
||||
// ERROR: Null can not be a value of a non-null type Iterator<String?>
|
||||
package demo
|
||||
|
||||
internal class Test : Iterable<String?> {
|
||||
override fun iterator(): Iterator<String?> {
|
||||
return null
|
||||
}
|
||||
|
||||
fun push(i: Iterator<String?>?): Iterator<String?>? {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
internal class FullTest : Iterable<String?> {
|
||||
override fun iterator(): Iterator<String?> {
|
||||
return null
|
||||
}
|
||||
|
||||
fun push(i: Iterator<String?>?): Iterator<String?>? {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// ERROR: Null can not be a value of a non-null type Iterator<String?>
|
||||
// ERROR: Null can not be a value of a non-null type Iterator<String?>
|
||||
package demo
|
||||
|
||||
internal class Test : Iterable<String?> {
|
||||
override fun iterator(): Iterator<String?> {
|
||||
return null
|
||||
}
|
||||
|
||||
fun push(i: Iterator<String?>?): Iterator<String?>? {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
internal class FullTest : Iterable<String?> {
|
||||
override fun iterator(): Iterator<String?> {
|
||||
return null
|
||||
}
|
||||
|
||||
fun push(i: Iterator<String?>?): Iterator<String?>? {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// ERROR: Null can not be a value of a non-null type Iterator<String?>
|
||||
package demo
|
||||
|
||||
internal class Test : Iterable<String?> {
|
||||
override fun iterator(): Iterator<String?> {
|
||||
return null
|
||||
}
|
||||
|
||||
fun push(i: Iterator<String?>?): Iterator<String?>? {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
valro = null as Any?
|
||||
val o = null as Any?
|
||||
@@ -0,0 +1,3 @@
|
||||
// !forceNotNullTypes: false
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
var l: List<T?>
|
||||
Reference in New Issue
Block a user