Auto generated GetResolver has constructor with wrong parameter order in Kotlin
See original GitHub issueReproduction steps:
- create class with more than two columns f.e.
@StorIOSQLiteType(table = "CreditCard")
data class CreditCard @StorIOSQLiteCreator constructor(
@get:StorIOSQLiteColumn(name = "id", key = true) val cardId: Long,
@get:StorIOSQLiteColumn(name = "name") val name: String,
@get:StorIOSQLiteColumn(name = "expireYear") val expireYear: Int,
@get:StorIOSQLiteColumn(name = "expireMonth") val expireMonth: Int,
@get:StorIOSQLiteColumn(name = "type") val type: String,
@get:StorIOSQLiteColumn(name = "isDefault") val isDefault: Boolean)
- build project (couple of times if needed).
The reason for that is kapt (kotlins annotation processor, don’t know about apt) does not process annotations in creation order.
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (3 by maintainers)
Top Results From Across the Web
How to fix wrong constructor parameters in kotlin
I have an interesting error with reflections in kotlin. So, im using 'argTypes' method for getting all parameter type of args. private fun ......
Read more >C# generator: wrong parameters order in the model ... - GitHub
As you can see parameter order in the constructor is wrong. It is somehow sorted by name (?). Is there a way to...
Read more >Data classes | Kotlin
The primary constructor needs to have at least one parameter. ... inside the primary constructor for the automatically generated functions.
Read more >Activity - Android Developers
It takes a single argument, an Intent , which describes the activity to be executed. ... Return the set of parameters which this...
Read more >Why is there no default constructor generated if you define an ...
First of all, default constructor is not generated, its provided by compiler if no-argument constructor is not written explicitly.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just checked that @pbochenski is actually right and you can get actual parameters names from
getParameters()
onExecutableElement
. So it should be possible to map columns with parameters relying just on their names.That’s a bummer 😔 I tested it properly before making PR with the fix and it worked. Need to investigate it further…