JVM: remove source code from not null assertion message text
This is implemented under a LanguageFeature which will be enabled later, when behavior change described in KT-57570 is approved. #KT-57570
This commit is contained in:
committed by
Space Team
parent
ea264cb5b5
commit
fc0ce415d7
@@ -320,9 +320,17 @@ class GenerationState private constructor(
|
||||
val assertionsMode: JVMAssertionsMode = configuration.get(JVMConfigurationKeys.ASSERTIONS_MODE, JVMAssertionsMode.DEFAULT)
|
||||
val isInlineDisabled: Boolean = configuration.getBoolean(CommonConfigurationKeys.DISABLE_INLINE)
|
||||
val useTypeTableInSerializer: Boolean = configuration.getBoolean(JVMConfigurationKeys.USE_TYPE_TABLE)
|
||||
val unifiedNullChecks: Boolean =
|
||||
languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
||||
!configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS)
|
||||
val unifiedNullChecks: Boolean = (
|
||||
languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 &&
|
||||
!configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS)
|
||||
).also {
|
||||
check(it || !languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions)) {
|
||||
// This assertion is needed because we generate calls to `Intrinsics.checkNotNull` which is only available since 1.4.
|
||||
"Language feature ${LanguageFeature.NoSourceCodeInNotNullAssertionExceptions.name} is not supported " +
|
||||
"if -Xno-unified-null-checks is enabled."
|
||||
}
|
||||
}
|
||||
|
||||
val generateSmapCopyToAnnotation: Boolean = !configuration.getBoolean(JVMConfigurationKeys.NO_SOURCE_DEBUG_EXTENSION)
|
||||
val functionsWithInlineClassReturnTypesMangled: Boolean =
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.MangleClassMembersReturningInlineClasses)
|
||||
|
||||
+70
-12
@@ -29182,12 +29182,6 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
@@ -29296,12 +29290,6 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterWithMixedNullableAndNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMixedNullableAndNotNullableBounds() throws Exception {
|
||||
@@ -29378,6 +29366,76 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_after.kt")
|
||||
public void testField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void testLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void testSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void testStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void testSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+70
-12
@@ -29182,12 +29182,6 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
@@ -29296,12 +29290,6 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterWithMixedNullableAndNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMixedNullableAndNotNullableBounds() throws Exception {
|
||||
@@ -29378,6 +29366,76 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_after.kt")
|
||||
public void testField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void testLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void testSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void testStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void testSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+35
-17
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.*
|
||||
import org.jetbrains.kotlin.backend.jvm.unboxInlineClass
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
@@ -736,26 +737,19 @@ private class TypeOperatorLowering(private val backendContext: JvmBackendContext
|
||||
irNot(lowerInstanceOf(expression.argument.transformVoid(), expression.typeOperand))
|
||||
|
||||
IrTypeOperator.IMPLICIT_NOTNULL -> {
|
||||
val owner = scope.scopeOwnerSymbol.owner
|
||||
val source = if (owner is IrFunction && owner.isDelegated()) {
|
||||
"${owner.name.asString()}(...)"
|
||||
} else {
|
||||
val declarationParent = parent as? IrDeclaration
|
||||
val sourceView = declarationParent?.let(::sourceViewFor)
|
||||
val (startOffset, endOffset) = expression.extents()
|
||||
if (sourceView?.validSourcePosition(startOffset, endOffset) == true) {
|
||||
sourceView.subSequence(startOffset, endOffset).toString()
|
||||
} else {
|
||||
// Fallback for inconsistent line numbers
|
||||
(declarationParent as? IrDeclarationWithName)?.name?.asString() ?: "Unknown Declaration"
|
||||
}
|
||||
}
|
||||
val text = computeNotNullAssertionText(expression)
|
||||
|
||||
irLetS(expression.argument.transformVoid(), irType = context.irBuiltIns.anyNType) { valueSymbol ->
|
||||
irComposite(resultType = expression.type) {
|
||||
+irCall(checkExpressionValueIsNotNull).apply {
|
||||
putValueArgument(0, irGet(valueSymbol.owner))
|
||||
putValueArgument(1, irString(source.trimForRuntimeAssertion()))
|
||||
if (text != null) {
|
||||
+irCall(checkExpressionValueIsNotNull).apply {
|
||||
putValueArgument(0, irGet(valueSymbol.owner))
|
||||
putValueArgument(1, irString(text.trimForRuntimeAssertion()))
|
||||
}
|
||||
} else {
|
||||
+irCall(backendContext.ir.symbols.checkNotNull).apply {
|
||||
putValueArgument(0, irGet(valueSymbol.owner))
|
||||
}
|
||||
}
|
||||
+irGet(valueSymbol.owner)
|
||||
}
|
||||
@@ -769,6 +763,30 @@ private class TypeOperatorLowering(private val backendContext: JvmBackendContext
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrBuilderWithScope.computeNotNullAssertionText(typeOperatorCall: IrTypeOperatorCall): String? {
|
||||
if (backendContext.state.languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions)) {
|
||||
return when (val argument = typeOperatorCall.argument) {
|
||||
is IrCall -> "${argument.symbol.owner.name.asString()}(...)"
|
||||
is IrGetField -> argument.symbol.owner.name.asString()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
val owner = scope.scopeOwnerSymbol.owner
|
||||
if (owner is IrFunction && owner.isDelegated())
|
||||
return "${owner.name.asString()}(...)"
|
||||
|
||||
val declarationParent = parent as? IrDeclaration
|
||||
val sourceView = declarationParent?.let(::sourceViewFor)
|
||||
val (startOffset, endOffset) = typeOperatorCall.extents()
|
||||
return if (sourceView?.validSourcePosition(startOffset, endOffset) == true) {
|
||||
sourceView.subSequence(startOffset, endOffset).toString()
|
||||
} else {
|
||||
// Fallback for inconsistent line numbers
|
||||
(declarationParent as? IrDeclarationWithName)?.name?.asString() ?: "Unknown Declaration"
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.trimForRuntimeAssertion() = StringUtil.trimMiddle(this, 50)
|
||||
|
||||
private fun IrFunction.isDelegated() =
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "s must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public String s = null;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions
|
||||
// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR
|
||||
// Reason: KT-56760
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "J().s must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public String s = null;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
val variable = J().s()
|
||||
f(variable)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == null)
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public final String s() { return null; }
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions
|
||||
// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR
|
||||
// Reason: KT-56760
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
val variable = J().s()
|
||||
f(variable)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "variable must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public final String s() { return null; }
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s())
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "s(...) must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public final String s() { return null; }
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions
|
||||
// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR
|
||||
// Reason: KT-56760
|
||||
// TARGET_BACKEND: JVM
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J.s())
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "s(...) must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static String s() { return null; }
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions
|
||||
// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR
|
||||
// Reason: KT-56760
|
||||
// TARGET_BACKEND: JVM
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "getS(...) must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public String getS() { return null; }
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions
|
||||
// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR
|
||||
// Reason: KT-56760
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: test.kt
|
||||
fun f(x: String) = "Fail 1"
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s)
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "J().s must not be null")
|
||||
"OK"
|
||||
else
|
||||
"Fail: ${e.message}"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public String getS() { return null; }
|
||||
}
|
||||
+70
-12
@@ -27766,12 +27766,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
@@ -27880,12 +27874,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterWithMixedNullableAndNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMixedNullableAndNotNullableBounds() throws Exception {
|
||||
@@ -27962,6 +27950,76 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_after.kt")
|
||||
public void testField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void testLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void testSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void testStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void testSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+70
-12
@@ -29182,12 +29182,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
@@ -29296,12 +29290,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterWithMixedNullableAndNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMixedNullableAndNotNullableBounds() throws Exception {
|
||||
@@ -29378,6 +29366,76 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_after.kt")
|
||||
public void testField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void testLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void testSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void testStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void testSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+70
-12
@@ -29182,12 +29182,6 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
@@ -29296,12 +29290,6 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterWithMixedNullableAndNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMixedNullableAndNotNullableBounds() throws Exception {
|
||||
@@ -29378,6 +29366,76 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_after.kt")
|
||||
public void testField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void testLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void testSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void testStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void testSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+63
-10
@@ -23495,11 +23495,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("errorMessage.kt")
|
||||
public void testErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt");
|
||||
@@ -23585,11 +23580,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/privateOperatorParameterAssertions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("staticCallErrorMessage.kt")
|
||||
public void testStaticCallErrorMessage() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterWithMultipleNotNullableBounds.kt")
|
||||
public void testTypeParameterWithMultipleNotNullableBounds() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/typeParameterWithMultipleNotNullableBounds.kt");
|
||||
@@ -23653,6 +23643,69 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExpressionAssertionMessages extends AbstractLightAnalysisModeTest {
|
||||
@TestMetadata("field_after.kt")
|
||||
public void ignoreField_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localVariable_after.kt")
|
||||
public void ignoreLocalVariable_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple_after.kt")
|
||||
public void ignoreSimple_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("staticCall_after.kt")
|
||||
public void ignoreStaticCall_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_after.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticProperty_after.kt")
|
||||
public void ignoreSyntheticProperty_after() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_after.kt");
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("field_before.kt")
|
||||
public void testField_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localVariable_before.kt")
|
||||
public void testLocalVariable_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple_before.kt")
|
||||
public void testSimple_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("staticCall_before.kt")
|
||||
public void testStaticCall_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticProperty_before.kt")
|
||||
public void testSyntheticProperty_before() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -340,6 +340,7 @@ enum class LanguageFeature(
|
||||
ImplicitSignedToUnsignedIntegerConversion(sinceVersion = null), // KT-56583
|
||||
ForbidInferringTypeVariablesIntoEmptyIntersection(sinceVersion = null, kind = BUG_FIX), // KT-51221
|
||||
IntrinsicConstEvaluation(sinceVersion = null, kind = UNSTABLE_FEATURE), // KT-49303
|
||||
NoSourceCodeInNotNullAssertionExceptions(sinceVersion = null, sinceApiVersion = ApiVersion.KOTLIN_1_4, kind = OTHER), // KT-57570
|
||||
;
|
||||
|
||||
init {
|
||||
|
||||
+10
@@ -21560,6 +21560,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -21698,6 +21698,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -21698,6 +21698,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10
@@ -21698,6 +21698,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+14
@@ -24882,6 +24882,20 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -25376,6 +25376,22 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+13
@@ -24635,6 +24635,19 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+15
@@ -25129,6 +25129,21 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class ExpressionAssertionMessages {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+13
@@ -19156,6 +19156,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExpressionAssertionMessages extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExpressionAssertionMessages() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullCheckOnLambdaReturnValue")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user