From 93500e7ab3d4caa0d718ed1bf5fa1b6057b07b5a Mon Sep 17 00:00:00 2001 From: Azat Abdullin Date: Thu, 23 May 2024 15:23:35 +0200 Subject: [PATCH] new kotlin + new kotlin fixes --- .../javagen/ActionSequence2JavaPrinter.kt | 66 +++++++++++++++++-- .../kotlingen/ActionSequence2KotlinPrinter.kt | 40 +++++++++-- pom.xml | 6 +- 3 files changed, 99 insertions(+), 13 deletions(-) diff --git a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/javagen/ActionSequence2JavaPrinter.kt b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/javagen/ActionSequence2JavaPrinter.kt index 91a3ff6ba..f1cabf11d 100644 --- a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/javagen/ActionSequence2JavaPrinter.kt +++ b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/javagen/ActionSequence2JavaPrinter.kt @@ -7,12 +7,66 @@ import org.vorpal.research.kex.config.kexConfig import org.vorpal.research.kex.ktype.KexType import org.vorpal.research.kex.parameters.FinalParameters import org.vorpal.research.kex.parameters.Parameters -import org.vorpal.research.kex.reanimator.actionsequence.* +import org.vorpal.research.kex.reanimator.actionsequence.ActionList +import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence +import org.vorpal.research.kex.reanimator.actionsequence.ArrayClassConstantGetter +import org.vorpal.research.kex.reanimator.actionsequence.ArrayWrite +import org.vorpal.research.kex.reanimator.actionsequence.ClassConstantGetter +import org.vorpal.research.kex.reanimator.actionsequence.CodeAction +import org.vorpal.research.kex.reanimator.actionsequence.ConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.EnumValueCreation +import org.vorpal.research.kex.reanimator.actionsequence.ExternalConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.ExternalMethodCall +import org.vorpal.research.kex.reanimator.actionsequence.FieldSetter +import org.vorpal.research.kex.reanimator.actionsequence.InnerClassConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.MethodCall +import org.vorpal.research.kex.reanimator.actionsequence.MockCall +import org.vorpal.research.kex.reanimator.actionsequence.MockList +import org.vorpal.research.kex.reanimator.actionsequence.MockNewInstance +import org.vorpal.research.kex.reanimator.actionsequence.MockSetField +import org.vorpal.research.kex.reanimator.actionsequence.MockSetupMethod +import org.vorpal.research.kex.reanimator.actionsequence.NewArray +import org.vorpal.research.kex.reanimator.actionsequence.NewArrayWithInitializer +import org.vorpal.research.kex.reanimator.actionsequence.PrimaryValue +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionArrayWrite +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionCall +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetStaticField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionList +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewArray +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewInstance +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetStaticField +import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldGetter +import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldSetter +import org.vorpal.research.kex.reanimator.actionsequence.StaticMethodCall +import org.vorpal.research.kex.reanimator.actionsequence.StringValue +import org.vorpal.research.kex.reanimator.actionsequence.TestCall +import org.vorpal.research.kex.reanimator.actionsequence.UnknownSequence import org.vorpal.research.kex.reanimator.codegen.ActionSequencePrinter -import org.vorpal.research.kex.util.* +import org.vorpal.research.kex.util.getConstructor +import org.vorpal.research.kex.util.getMethod +import org.vorpal.research.kex.util.isSubtypeOfCached +import org.vorpal.research.kex.util.javaString +import org.vorpal.research.kex.util.kex +import org.vorpal.research.kex.util.loadClass import org.vorpal.research.kfg.ir.Class -import org.vorpal.research.kfg.type.* +import org.vorpal.research.kfg.type.ArrayType +import org.vorpal.research.kfg.type.BoolType +import org.vorpal.research.kfg.type.ByteType +import org.vorpal.research.kfg.type.CharType +import org.vorpal.research.kfg.type.ClassType +import org.vorpal.research.kfg.type.DoubleType +import org.vorpal.research.kfg.type.FloatType +import org.vorpal.research.kfg.type.IntType +import org.vorpal.research.kfg.type.LongType +import org.vorpal.research.kfg.type.NullType +import org.vorpal.research.kfg.type.ShortType import org.vorpal.research.kfg.type.Type +import org.vorpal.research.kfg.type.VoidType +import org.vorpal.research.kfg.type.classType +import org.vorpal.research.kfg.type.objectType import org.vorpal.research.kthelper.assert.ktassert import org.vorpal.research.kthelper.assert.unreachable import org.vorpal.research.kthelper.logging.log @@ -468,9 +522,9 @@ open class ActionSequence2JavaPrinter( actualTypes[this] = ASClass(ctx.types.byteType) } - is Char -> when (value) { - in 'a'..'z' -> "'$value'" - in 'A'..'Z' -> "'$value'" + is Char -> when { + value in 'a'..'z' -> "'$value'" + value in 'A'..'Z' -> "'$value'" else -> "(char) ${value.code}" }.also { actualTypes[this] = ASClass(ctx.types.charType) diff --git a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/kotlingen/ActionSequence2KotlinPrinter.kt b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/kotlingen/ActionSequence2KotlinPrinter.kt index 85d027e78..3d4e9e257 100644 --- a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/kotlingen/ActionSequence2KotlinPrinter.kt +++ b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/kotlingen/ActionSequence2KotlinPrinter.kt @@ -4,7 +4,39 @@ import org.vorpal.research.kex.ExecutionContext import org.vorpal.research.kex.ktype.KexType import org.vorpal.research.kex.parameters.FinalParameters import org.vorpal.research.kex.parameters.Parameters -import org.vorpal.research.kex.reanimator.actionsequence.* +import org.vorpal.research.kex.reanimator.actionsequence.ActionList +import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence +import org.vorpal.research.kex.reanimator.actionsequence.ArrayClassConstantGetter +import org.vorpal.research.kex.reanimator.actionsequence.ArrayWrite +import org.vorpal.research.kex.reanimator.actionsequence.ClassConstantGetter +import org.vorpal.research.kex.reanimator.actionsequence.CodeAction +import org.vorpal.research.kex.reanimator.actionsequence.ConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.EnumValueCreation +import org.vorpal.research.kex.reanimator.actionsequence.ExternalConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.ExternalMethodCall +import org.vorpal.research.kex.reanimator.actionsequence.FieldSetter +import org.vorpal.research.kex.reanimator.actionsequence.InnerClassConstructorCall +import org.vorpal.research.kex.reanimator.actionsequence.MethodCall +import org.vorpal.research.kex.reanimator.actionsequence.MockList +import org.vorpal.research.kex.reanimator.actionsequence.NewArray +import org.vorpal.research.kex.reanimator.actionsequence.NewArrayWithInitializer +import org.vorpal.research.kex.reanimator.actionsequence.PrimaryValue +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionArrayWrite +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionCall +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetStaticField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionList +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewArray +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewInstance +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetField +import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetStaticField +import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldGetter +import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldSetter +import org.vorpal.research.kex.reanimator.actionsequence.StaticMethodCall +import org.vorpal.research.kex.reanimator.actionsequence.StringValue +import org.vorpal.research.kex.reanimator.actionsequence.TestCall +import org.vorpal.research.kex.reanimator.actionsequence.UnknownSequence import org.vorpal.research.kex.reanimator.codegen.ActionSequencePrinter import org.vorpal.research.kex.util.getConstructor import org.vorpal.research.kex.util.getMethod @@ -433,9 +465,9 @@ open class ActionSequence2KotlinPrinter( actualTypes[this] = ASClass(ctx.types.byteType, nullable = false) } - is Char -> when (value) { - in 'a'..'z' -> "'$value'" - in 'A'..'Z' -> "'$value'" + is Char -> when { + value in 'a'..'z' -> "'$value'" + value in 'A'..'Z' -> "'$value'" else -> "${value.code}.toChar()" }.also { actualTypes[this] = ASClass(ctx.types.charType, nullable = false) diff --git a/pom.xml b/pom.xml index 526947f12..442b00512 100644 --- a/pom.xml +++ b/pom.xml @@ -24,10 +24,10 @@ ${jvm.version} ${jvm.version} - 1.9.23 + 2.0.0 official - 1.5.1 - 1.8.0 + 1.7.0-RC + 1.8.1 0.3.5 3.5.1