Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin mutator testing #23

Merged
merged 16 commits into from
Dec 23, 2022
Merged

Kotlin mutator testing #23

merged 16 commits into from
Dec 23, 2022

Conversation

s2176416
Copy link
Collaborator

What it does

Testing for kotlin language specific implementation

How it works

Converted stryker4jvm-mutator-kotlin to gradle module to resolve runtime reflection issues.
Implemented tests for all components.
Currently circumvents config as the current design makes the testing of individual components a hassle

README

Do not forget to clean install stryker4jvm-core as well as doing a clean build with gradle for stryker4jvm-mutator-kotlin followed by a publishToMavenLocal!

s2176416 and others added 13 commits December 14, 2022 15:26
Removed redundant scala files
Many bugs fixed with tests not being run by maven
Modified KotlinAST to fake immutability, I am pretty sure you can insert new elements into KtElements however this would change the hashCode of the AST and result in problems.
Added more constructors for kotlin classes to support variety in used mutators
# Conflicts:
#	stryker4jvm-mutator-kotlin/src/test/kotlin/stryker4jvm/mutator/kotlin/InstrumenterTest.kt
# Conflicts:
#	stryker4jvm-mutator-kotlin/src/main/kotlin/stryker4jvm/mutator/kotlin/KotlinInstrumenter.kt
#	stryker4jvm-mutator-kotlin/src/main/kotlin/stryker4jvm/mutator/kotlin/KotlinParser.kt
Circumvent is made because the current way of passing down a config makes it really hard to test individual components as they now all require a configuration. Would be better if they were passed to the constructor once (of the class that extends LanguageMutator) such that individual components do not depend on this configuration anymore (config can be used once and then discarded as classes should be initialized based on config)
Fixed issue with stryker4jvm-core exception having multiple constructors
plugins {
kotlin("jvm") //version "1.5.10"
kotlin("plugin.serialization") version "1.5.10"
kotlin("jvm") version "1.4.20"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a downgrade necessary here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yessir, that is the reason why we get runtime exceptions. Version 1.5 and above does not allow illegal reflections which stryker4k depends on

@@ -45,4 +46,8 @@ class KotlinCollector : Collector<KotlinAST> {

return res
}

fun collect(tree: KotlinAST?): CollectedMutants<KotlinAST> {
return collect(tree, LanguageMutatorConfig(mutableSetOf()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are not using the languageconfig, can't you leave it null and add a nullable to collect(tree, config)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, I fogot about that because instead of compiler issues I was given a runtime exception because the private config variable of the base language mutator was null

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has now been changed

s2176416 and others added 3 commits December 22, 2022 13:11
…ST but instead modifying the original.

Note that it still modifies the original but that we wrap the resulting tree into a new AST
@LvanArkel LvanArkel merged commit 263421f into master Dec 23, 2022
@s2176416 s2176416 deleted the kotlin-mutator-testing branch January 6, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants