How do I determine if a property has a backing field? #792
Unanswered
dylanenabled
asked this question in
Ask a Question
Replies: 1 comment 1 reply
-
|
Thx for the feedback. We will add a dedicated In the meantime you can access Konsist
.scopeFromProject()
.properties()
.setters
.assertTrue { it.text.contains("field =") } |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Wanted end result.
I have a test which ensures that kotlinx
@Serializableclasses use snake case@SerialNamefor the fields that will be serialised (the actual names use camel case). However some of the fields are properties that are computed via lazy delegates and so are not serialized, thus they don't need the@SerialNameannotation and the test should skip them.I want to be able to check in my test if the property has a backing field or not to skip those properties.
What you tried so far.
I am currently using a check for
hasImplementation || delegateName != nullto skip but it seems possible that even if hasImplementation is true, it could still have a backing field.Beta Was this translation helpful? Give feedback.
All reactions