[JVM IR] ForLoopsLowering: Keep IMPLICIT_NOTNULL type-casts in next()
and `componentN()` calls. There were issues when we have iterables from Java where the element type has "not null" type information.
This commit is contained in:
committed by
Dmitry Petrov
parent
e54ef3bdb8
commit
2dd8727baf
+79
-10
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
@@ -17,8 +18,8 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl
|
||||
import org.jetbrains.kotlin.ir.util.dump
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.ir.visitors.*
|
||||
|
||||
val forLoopsPhase = makeIrFilePhase(
|
||||
::ForLoopsLowering,
|
||||
@@ -230,7 +231,7 @@ private class RangeLoopTransformer(
|
||||
//
|
||||
// val i = inductionVariable // For progressions, or `array[inductionVariable]` for arrays
|
||||
// inductionVariable = inductionVariable + step
|
||||
val initializer = mainLoopVariable.initializer as IrCall
|
||||
val initializer = mainLoopVariable.initializer!!
|
||||
val replacement = with(context.createIrBuilder(getScopeOwnerSymbol(), initializer.startOffset, initializer.endOffset)) {
|
||||
IrCompositeImpl(
|
||||
mainLoopVariable.startOffset,
|
||||
@@ -269,6 +270,35 @@ private class RangeLoopTransformer(
|
||||
val loopVariableComponentIndices: List<Int>
|
||||
)
|
||||
|
||||
private class FindInitializerCallVisitor(private val mainLoopVariable: IrVariable?) : IrElementVisitorVoid {
|
||||
var initializerCall: IrCall? = null
|
||||
|
||||
override fun visitElement(element: IrElement) {
|
||||
element.acceptChildrenVoid(this)
|
||||
}
|
||||
|
||||
override fun visitCall(expression: IrCall) {
|
||||
val candidateCall = when (expression.origin) {
|
||||
IrStatementOrigin.FOR_LOOP_NEXT -> expression
|
||||
is IrStatementOrigin.COMPONENT_N ->
|
||||
if (mainLoopVariable != null && (expression.dispatchReceiver as? IrGetValue)?.symbol == mainLoopVariable.symbol) {
|
||||
expression
|
||||
} else {
|
||||
null
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
when {
|
||||
candidateCall == null -> super.visitCall(expression)
|
||||
initializerCall == null -> initializerCall = candidateCall
|
||||
else -> throw IllegalStateException(
|
||||
"Multiple initializer calls found. First: ${initializerCall!!.render()}\nSecond: ${candidateCall.render()}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun gatherLoopVariableInfo(statements: MutableList<IrStatement>): LoopVariableInfo {
|
||||
// The "next" statement (at the top of the loop) looks something like:
|
||||
//
|
||||
@@ -288,19 +318,58 @@ private class RangeLoopTransformer(
|
||||
val loopVariableComponentIndices = mutableListOf<Int>()
|
||||
for ((i, stmt) in statements.withIndex()) {
|
||||
if (stmt !is IrVariable) continue
|
||||
val initializer = stmt.initializer as? IrCall
|
||||
val initializer = stmt.initializer?.let {
|
||||
// The `next()` and `componentN()` calls could be wrapped in an IMPLICIT_NOTNULL type-cast when the iterator comes from Java
|
||||
// and the iterator's type parameter has enhanced nullability information (either explicit or implicit). Therefore we need
|
||||
// to traverse the initializer to find the `next()` or `componentN()` call. Example:
|
||||
//
|
||||
// // In Java:
|
||||
// public static Collection<@NotNull String> collection() { /* ... */ }
|
||||
//
|
||||
// // In Kotlin:
|
||||
// for ((i, s) in JavaClass.collection().withIndex()) {
|
||||
// println("$i: ${s.toUpperCase()}") // NOTE: `s` is not nullable
|
||||
// }
|
||||
//
|
||||
// The variable declaration for `s` looks like this:
|
||||
//
|
||||
// VAR name:s type:@[NotNull(...)] kotlin.String [val]
|
||||
// TYPE_OP type=@[NotNull(...)] kotlin.String origin=IMPLICIT_NOTNULL typeOperand=@[NotNull(...)] kotlin.String
|
||||
// CALL 'public final fun component2 (): T of ...IndexedValue [operator] declared in ...IndexedValue' type=@[NotNull(...)] kotlin.String origin=COMPONENT_N(index=2)
|
||||
// $this: GET_VAR 'val tmp1_loop_parameter: ...IndexedValue<@[NotNull(...)] kotlin.String> [val] declared in <root>.box' type=...IndexedValue<@[NotNull(...)] kotlin.String> origin=null
|
||||
//
|
||||
// Enhanced nullability information can be implicit if the Java function overrides a Kotlin function. Example:
|
||||
//
|
||||
// // In Java:
|
||||
// public class AImpl implements A {
|
||||
// // NOTE: The array and String are both implicitly not nullable because they are not nullable in A.array()
|
||||
// @Override public String[] array() { return new String[0]; }
|
||||
// }
|
||||
//
|
||||
// // In Kotlin
|
||||
// interface A {
|
||||
// fun array(): Array<String>
|
||||
// }
|
||||
// for (s in AImpl().array()) {
|
||||
// println(s.toUpperCase()) // NOTE: `s` is not nullable
|
||||
// }
|
||||
//
|
||||
// The variable declaration for `s` looks like this:
|
||||
//
|
||||
// VAR name:s type:kotlin.String [val]
|
||||
// TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||
// CALL 'public abstract fun next (): T of ...Iterator [operator] declared in ...Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
|
||||
// $this: GET_VAR 'val tmp0_iterator: ...Iterator<kotlin.String> [val] declared in <root>.box' type=...Iterator<kotlin.String> origin=null
|
||||
FindInitializerCallVisitor(mainLoopVariable).apply { it.acceptVoid(this) }.initializerCall
|
||||
}
|
||||
when (val origin = initializer?.origin) {
|
||||
IrStatementOrigin.FOR_LOOP_NEXT -> {
|
||||
mainLoopVariable = stmt
|
||||
mainLoopVariableIndex = i
|
||||
}
|
||||
is IrStatementOrigin.COMPONENT_N -> {
|
||||
if (mainLoopVariable != null &&
|
||||
(initializer.dispatchReceiver as? IrGetValue)?.symbol == mainLoopVariable.symbol
|
||||
) {
|
||||
loopVariableComponents[origin.index] = stmt
|
||||
loopVariableComponentIndices.add(i)
|
||||
}
|
||||
loopVariableComponents[origin.index] = stmt
|
||||
loopVariableComponentIndices.add(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
-7
@@ -22,9 +22,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrDoWhileLoopImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrWhileLoopImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.coerceToUnitIfNeeded
|
||||
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
|
||||
import org.jetbrains.kotlin.ir.util.functions
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
/**
|
||||
@@ -303,6 +301,22 @@ internal class ProgressionLoopHeader(
|
||||
}
|
||||
}
|
||||
|
||||
private class InitializerCallReplacer(symbolRemapper: SymbolRemapper, typeRemapper: TypeRemapper, val replacementCall: IrCall) :
|
||||
DeepCopyIrTreeWithSymbols(symbolRemapper, typeRemapper) {
|
||||
var initializerCall: IrCall? = null
|
||||
|
||||
override fun visitCall(expression: IrCall): IrCall {
|
||||
if (initializerCall == null) {
|
||||
initializerCall = expression
|
||||
return replacementCall
|
||||
} else {
|
||||
throw IllegalStateException(
|
||||
"Multiple initializer calls found. First: ${initializerCall!!.render()}\nSecond: ${expression.render()}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class IndexedGetLoopHeader(
|
||||
headerInfo: IndexedGetHeaderInfo,
|
||||
builder: DeclarationIrBuilder
|
||||
@@ -319,11 +333,15 @@ internal class IndexedGetLoopHeader(
|
||||
with(builder) {
|
||||
// loopVariable = objectVariable[inductionVariable]
|
||||
val indexedGetFun = with(headerInfo.expressionHandler) { headerInfo.objectVariable.type.getFunction }
|
||||
val get = irCall(indexedGetFun).apply {
|
||||
val get = irCall(indexedGetFun.symbol).apply {
|
||||
dispatchReceiver = irGet(headerInfo.objectVariable)
|
||||
putValueArgument(0, irGet(inductionVariable))
|
||||
}
|
||||
loopVariable?.initializer = get
|
||||
// The call could be wrapped in an IMPLICIT_NOTNULL type-cast (see comment in ForLoopsLowering.gatherLoopVariableInfo()).
|
||||
// Find and replace the call to preserve any type-casts.
|
||||
loopVariable?.initializer = loopVariable?.initializer?.deepCopyWithSymbols { symbolRemapper, typeRemapper ->
|
||||
InitializerCallReplacer(symbolRemapper, typeRemapper, get)
|
||||
}
|
||||
// Even if there is no loop variable, we always want to call `get()` as it may have side-effects.
|
||||
// The un-lowered loop always calls `get()` on each iteration.
|
||||
listOf(loopVariable ?: get) + incrementInductionVariable(this)
|
||||
@@ -517,10 +535,16 @@ internal class IterableLoopHeader(
|
||||
// loopVariable = iteratorVar.next()
|
||||
val iteratorClass = headerInfo.iteratorVariable.type.getClass()!!
|
||||
val next =
|
||||
irCall(iteratorClass.functions.first { it.name == OperatorNameConventions.NEXT && it.valueParameters.isEmpty() }).apply {
|
||||
irCall(iteratorClass.functions.first {
|
||||
it.name == OperatorNameConventions.NEXT && it.valueParameters.isEmpty()
|
||||
}.symbol).apply {
|
||||
dispatchReceiver = irGet(headerInfo.iteratorVariable)
|
||||
}
|
||||
loopVariable?.initializer = next
|
||||
// The call could be wrapped in an IMPLICIT_NOTNULL type-cast (see comment in ForLoopsLowering.gatherLoopVariableInfo()).
|
||||
// Find and replace the call to preserve any type-casts.
|
||||
loopVariable?.initializer = loopVariable?.initializer?.deepCopyWithSymbols { symbolRemapper, typeRemapper ->
|
||||
InitializerCallReplacer(symbolRemapper, typeRemapper, next)
|
||||
}
|
||||
// Even if there is no loop variable, we always want to call `next()` for iterables and sequences.
|
||||
listOf(loopVariable ?: next.coerceToUnitIfNeeded(next.type, context.irBuiltIns))
|
||||
}
|
||||
|
||||
@@ -33,11 +33,14 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import java.util.*
|
||||
|
||||
inline fun <reified T : IrElement> T.deepCopyWithSymbols(initialParent: IrDeclarationParent? = null): T {
|
||||
inline fun <reified T : IrElement> T.deepCopyWithSymbols(
|
||||
initialParent: IrDeclarationParent? = null,
|
||||
createCopier: (SymbolRemapper, TypeRemapper) -> DeepCopyIrTreeWithSymbols = ::DeepCopyIrTreeWithSymbols
|
||||
): T {
|
||||
val symbolRemapper = DeepCopySymbolRemapper()
|
||||
acceptVoid(symbolRemapper)
|
||||
val typeRemapper = DeepCopyTypeRemapper(symbolRemapper)
|
||||
return transform(DeepCopyIrTreeWithSymbols(symbolRemapper, typeRemapper), null).patchDeclarationParents(initialParent) as T
|
||||
return transform(createCopier(symbolRemapper, typeRemapper), null).patchDeclarationParents(initialParent) as T
|
||||
}
|
||||
|
||||
interface SymbolRenamer {
|
||||
@@ -58,9 +61,11 @@ interface SymbolRenamer {
|
||||
open class DeepCopyIrTreeWithSymbols(
|
||||
private val symbolRemapper: SymbolRemapper,
|
||||
private val typeRemapper: TypeRemapper,
|
||||
private val symbolRenamer: SymbolRenamer = SymbolRenamer.DEFAULT
|
||||
private val symbolRenamer: SymbolRenamer
|
||||
) : IrElementTransformerVoid() {
|
||||
|
||||
constructor(symbolRemapper: SymbolRemapper, typeRemapper: TypeRemapper) : this(symbolRemapper, typeRemapper, SymbolRenamer.DEFAULT)
|
||||
|
||||
init {
|
||||
// TODO refactor
|
||||
(typeRemapper as? DeepCopyTypeRemapper)?.let {
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in JImpl().arrayOfNotNull()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun arrayOfNotNull(): Array<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
public class JImpl implements J {
|
||||
// The only way to get @EnhancedNullability on the array element type (Int) is to override a Kotlin function that
|
||||
// returns `Array<Int>` (where Int is not nullable). `@NotNull Integer[]` makes the array not nullable, not String.
|
||||
@Override
|
||||
public Integer[] arrayOfNotNull() {
|
||||
return new Integer[] { 42, -42 };
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i = JImpl().arrayOfNotNull()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i in JImpl().arrayOfNotNull()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun arrayOfNotNull(): Array<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
public class JImpl implements J {
|
||||
// The only way to get @EnhancedNullability on the array element type (Int) is to override a Kotlin function that
|
||||
// returns `Array<Int>` (where Int is not nullable). `@NotNull Integer[]` makes the array not nullable, not String.
|
||||
@Override
|
||||
public Integer[] arrayOfNotNull() {
|
||||
return new Integer[] { null };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in J.arrayOfMaybeNullable()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { 42, null };
|
||||
}
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i: Int in J.arrayOfMaybeNullable()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { 42, -42 };
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with a NullPointerException in the loop header. The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
// The NPE is due to calling `intValue()` on the null Int; it is expected to be asserted as non-null first.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i: Int = J.arrayOfMaybeNullable()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i: Int in J.arrayOfMaybeNullable()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { null };
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in J.listOfNotNull()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i = J.listOfNotNull()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i in J.listOfNotNull()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int?>()
|
||||
for (i in J.listOfNullable()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@Nullable Integer> listOfNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(null);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Nullable.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @Nullable does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.Nullable for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface Nullable {
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in JImpl().listOfNotNull()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun listOfNotNull(): List<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
import java.util.*;
|
||||
|
||||
public class JImpl implements J {
|
||||
// Type argument (Int) gets @EnhancedNullability because it is not nullable in overridden Kotlin function.
|
||||
@Override
|
||||
public List<Integer> listOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i = JImpl().listOfNotNull()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i in JImpl().listOfNotNull()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun listOfNotNull(): List<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
import java.util.*;
|
||||
|
||||
public class JImpl implements J {
|
||||
// Type argument (Int) gets @EnhancedNullability because it is not nullable in overridden Kotlin function.
|
||||
@Override
|
||||
public List<Integer> listOfNotNull() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in J.listOfMaybeNullable()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(null);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i: Int in J.listOfMaybeNullable()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with a NullPointerException in the loop header. The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
// The NPE is due to calling `intValue()` on the null Int; it is expected to be asserted as non-null first.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i: Int = J.listOfMaybeNullable()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i: Int in J.listOfMaybeNullable()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val map = java.util.LinkedHashMap<Int, Int>()
|
||||
map.put(3, 42)
|
||||
map.put(14, -42)
|
||||
|
||||
// Even though the type parameters on `map` are not nullable, the `values` property is implemented in Java and therefore there is
|
||||
// @EnhancedNullability on its type argument (Int).
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (v in map.values) {
|
||||
actualValues += v
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val map = java.util.LinkedHashMap<Int, Int>()
|
||||
map.put(3, 42)
|
||||
map.put(14, -42)
|
||||
|
||||
// Even though the type parameters on `map` are not nullable, the `values` property is implemented in Java and therefore there is
|
||||
// @EnhancedNullability on its type argument (Int), which gets propagated on the call to `toTypedArray()`.
|
||||
// If we simply called `map.toTypedArray()` there would be no @EnhancedNullability on Int.
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (v in map.values.toTypedArray()) {
|
||||
actualValues += v
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in J.listOfNotNull().toTypedArray()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i = J.listOfNotNull().toTypedArray()[0]
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i in J.listOfNotNull().toTypedArray()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for (i in J.iteratorOfNotNull()) {
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static Iterator<@NotNull Integer> iteratorOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list.iterator();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when
|
||||
// assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on KtParameters.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val i = J.iteratorOfNotNull().next()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for (i in J.iteratorOfNotNull()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static Iterator<@NotNull Integer> iteratorOfNotNull() {
|
||||
return Collections.<Integer>singletonList(null).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i) in JImpl().arrayOfNotNull().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun arrayOfNotNull(): Array<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
public class JImpl implements J {
|
||||
// The only way to get @EnhancedNullability on the array element type (Int) is to override a Kotlin function that
|
||||
// returns `Array<Int>` (where Int is not nullable). `@NotNull Integer[]` makes the array not nullable, not String.
|
||||
@Override
|
||||
public Integer[] arrayOfNotNull() {
|
||||
return new Integer[] { 42, -42 };
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get()". The not-null assertion is not generated when assigning to the
|
||||
// variables in the destructuring declaration. The root cause seems to be that
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on
|
||||
// KtDestructuringDeclarations and their entries.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val (index, i) = JImpl().arrayOfNotNull().withIndex().first()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for ((index, i) in JImpl().arrayOfNotNull().withIndex()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
interface J {
|
||||
fun arrayOfNotNull(): Array<Int>
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
public class JImpl implements J {
|
||||
// The only way to get @EnhancedNullability on the array element type (Int) is to override a Kotlin function that
|
||||
// returns `Array<Int>` (where Int is not nullable). `@NotNull Integer[]` makes the array not nullable, not String.
|
||||
@Override
|
||||
public Integer[] arrayOfNotNull() {
|
||||
return new Integer[] { null };
|
||||
}
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i) in J.arrayOfMaybeNullable().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { 42, null };
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i: Int) in J.arrayOfMaybeNullable().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { 42, -42 };
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM, JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails because explicit types are ignored in destructuring declarations (KT-22392).
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val (index, i: Int) = J.arrayOfMaybeNullable().withIndex().first()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for ((index, i: Int) in J.arrayOfMaybeNullable().withIndex()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static Integer[] arrayOfMaybeNullable() {
|
||||
return new Integer[] { null };
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i) in J.listOfNotNull().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get()". The not-null assertion is not generated when assigning to the
|
||||
// variables in the destructuring declaration. The root cause seems to be that
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on
|
||||
// KtDestructuringDeclarations and their entries.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val (index, i) = J.listOfNotNull().withIndex().first()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for ((index, i) in J.listOfNotNull().withIndex()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@NotNull Integer> listOfNotNull() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int?>()
|
||||
for ((index, i) in J.listOfNullable().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static List<@Nullable Integer> listOfNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(null);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Nullable.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @Nullable does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.Nullable for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface Nullable {
|
||||
}
|
||||
compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i) in J.listOfMaybeNullable().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, null), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(null);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i: Int) in J.listOfMaybeNullable().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM, JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails because explicit types are ignored in destructuring declarations (KT-22392).
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val (index, i: Int) = J.listOfMaybeNullable().withIndex().first()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for ((index, i: Int) in J.listOfMaybeNullable().withIndex()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
public static List<Integer> listOfMaybeNullable() {
|
||||
return Collections.singletonList(null);
|
||||
}
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val actualIndices = mutableListOf<Int>()
|
||||
val actualValues = mutableListOf<Int>()
|
||||
for ((index, i) in J.iteratorOfNotNull().withIndex()) {
|
||||
actualIndices += index
|
||||
actualValues += i
|
||||
}
|
||||
assertEquals(listOf(0, 1), actualIndices)
|
||||
assertEquals(listOf(42, -42), actualValues)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static Iterator<@NotNull Integer> iteratorOfNotNull() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(42);
|
||||
list.add(-42);
|
||||
return list.iterator();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// Note: This fails on JVM (non-IR) with "Fail: should throw on get()". The not-null assertion is not generated when assigning to the
|
||||
// variables in the destructuring declaration. The root cause seems to be that
|
||||
// CodegenAnnotatingVisitor/RuntimeAssertionsOnDeclarationBodyChecker do not analyze the need for not-null assertions on
|
||||
// KtDestructuringDeclarations and their entries.
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
// Sanity check to make sure there IS an exception even when not in a for-loop
|
||||
try {
|
||||
val (index, i) = J.iteratorOfNotNull().withIndex().next()
|
||||
return "Fail: should throw on get()"
|
||||
} catch (e: IllegalStateException) {}
|
||||
|
||||
try {
|
||||
for ((index, i) in J.iteratorOfNotNull().withIndex()) {
|
||||
return "Fail: should throw on get() in loop header"
|
||||
}
|
||||
}
|
||||
catch (e: IllegalStateException) {}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public static Iterator<@NotNull Integer> iteratorOfNotNull() {
|
||||
return Collections.<Integer>singletonList(null).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: NotNull.java
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
// org.jetbrains.annotations used in the compiler is version 13, whose @NotNull does not support the TYPE_USE target (version 15 does).
|
||||
// We're using our own @org.jetbrains.annotations.NotNull for testing purposes.
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
|
||||
public @interface NotNull {
|
||||
}
|
||||
+186
@@ -20929,6 +20929,192 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNull.kt")
|
||||
public void testJavaArrayOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullable.kt")
|
||||
public void testJavaArrayOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNull.kt")
|
||||
public void testJavaCollectionOfExplicitNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullable.kt")
|
||||
public void testJavaCollectionOfExplicitNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNull.kt")
|
||||
public void testJavaCollectionOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullable.kt")
|
||||
public void testJavaCollectionOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlib.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlib() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlibToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlibToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlibToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArrayFailFast.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArrayFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNull.kt")
|
||||
public void testJavaIteratorOfNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndex.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndexFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndexFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndex.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndexFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+186
@@ -20929,6 +20929,192 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractLightAnalysisModeTest {
|
||||
@TestMetadata("javaArrayOfInheritedNotNullFailFast.kt")
|
||||
public void ignoreJavaArrayOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void ignoreJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullFailFast.kt")
|
||||
public void ignoreJavaCollectionOfExplicitNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNullFailFast.kt")
|
||||
public void ignoreJavaCollectionOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void ignoreJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArrayFailFast.kt")
|
||||
public void ignoreJavaCollectionOfNotNullToTypedArrayFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullFailFast.kt")
|
||||
public void ignoreJavaIteratorOfNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNull.kt")
|
||||
public void testJavaArrayOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullable.kt")
|
||||
public void testJavaArrayOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNull.kt")
|
||||
public void testJavaCollectionOfExplicitNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullable.kt")
|
||||
public void testJavaCollectionOfExplicitNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNull.kt")
|
||||
public void testJavaCollectionOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullable.kt")
|
||||
public void testJavaCollectionOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlib.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlib() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlibToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlibToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlibToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNull.kt")
|
||||
public void testJavaIteratorOfNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractLightAnalysisModeTest {
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndexFailFast.kt")
|
||||
public void ignoreJavaArrayOfInheritedNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void ignoreJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndexFailFast.kt")
|
||||
public void ignoreJavaCollectionOfExplicitNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void ignoreJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndexFailFast.kt")
|
||||
public void ignoreJavaIteratorOfNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndex.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndex.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+186
@@ -19413,6 +19413,192 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNull.kt")
|
||||
public void testJavaArrayOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullable.kt")
|
||||
public void testJavaArrayOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNull.kt")
|
||||
public void testJavaCollectionOfExplicitNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullable.kt")
|
||||
public void testJavaCollectionOfExplicitNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNull.kt")
|
||||
public void testJavaCollectionOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullable.kt")
|
||||
public void testJavaCollectionOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlib.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlib() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlibToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlibToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlibToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArrayFailFast.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArrayFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNull.kt")
|
||||
public void testJavaIteratorOfNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndex.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndexFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndexFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndex.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndexFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+186
@@ -19413,6 +19413,192 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNull.kt")
|
||||
public void testJavaArrayOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullable.kt")
|
||||
public void testJavaArrayOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaArrayOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNull.kt")
|
||||
public void testJavaCollectionOfExplicitNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullable.kt")
|
||||
public void testJavaCollectionOfExplicitNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNull.kt")
|
||||
public void testJavaCollectionOfInheritedNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfInheritedNotNullFailFast.kt")
|
||||
public void testJavaCollectionOfInheritedNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullable.kt")
|
||||
public void testJavaCollectionOfMaybeNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlib.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlib() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullFromStdlibToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullFromStdlibToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullFromStdlibToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArray.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArray() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfNotNullToTypedArrayFailFast.kt")
|
||||
public void testJavaCollectionOfNotNullToTypedArrayFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNull.kt")
|
||||
public void testJavaIteratorOfNotNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndex.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfInheritedNotNullWithIndexFailFast.kt")
|
||||
public void testJavaArrayOfInheritedNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfInheritedNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaArrayOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNotNullWithIndexFailFast.kt")
|
||||
public void testJavaCollectionOfExplicitNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfExplicitNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfExplicitNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndex.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt")
|
||||
public void testJavaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariableFailFast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndex.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndex() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaIteratorOfNotNullWithIndexFailFast.kt")
|
||||
public void testJavaIteratorOfNotNullWithIndexFailFast() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+26
@@ -16509,6 +16509,32 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+26
@@ -17689,6 +17689,32 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaInterop extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJavaInterop() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/javaInterop/withIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class WithIndex extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInWithIndex() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges/javaInterop/withIndex"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/ranges/literal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user