Skip to content

Conversation

mvicsokolova
Copy link
Collaborator

@mvicsokolova
Copy link
Collaborator Author

mvicsokolova commented Feb 27, 2024

In this PR I've also added a new test: a multi-module project where kotlinx-atomicfu is only applied to one module instead of the root project application. The bug with from the issue was only reproduced with cross-module usage of the class that inherited SynchronizedObject.

This test revealed another problem that was fixed here #405, based on the changes from the current PR.

override fun checkReferences(buildDir: File) {
val atomicfuDir = buildDir.resolve("classes/atomicfu/")
(if (atomicfuDir.exists() && atomicfuDir.isDirectory) atomicfuDir else buildDir).let {
val atomicfuDirExists = atomicfuDir.exists() && atomicfuDir.isDirectory
Copy link
Collaborator

Choose a reason for hiding this comment

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

In tests, we should know for sure how classes were transformed and what directories are expected to be there.
I recommend reducing the amount of conditional logic here and instead explicitly pass a directory and a flag to filter out the metadata from the test.
Otherwise, we may end up in a situation when build directories layout will change, this test won't be update accidentally, and it'll no longer catch the problem with afu-references as it will always filter the metadata.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, this got very complicated. I've separated these cases

@mvicsokolova
Copy link
Collaborator Author

I've fixed the tests: in case of bytecode transformation we should only check classes in classes/atomicfu directory, otherwise classes/atomicfu-orig directory with original classes will be checked as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants