question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto generated GetResolver has constructor with wrong parameter order in Kotlin

See original GitHub issue

Reproduction steps:

  1. 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)
  1. 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:closed
  • Created 7 years ago
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
geralt-encorecommented, Dec 17, 2016

I just checked that @pbochenski is actually right and you can get actual parameters names from getParameters() on ExecutableElement. So it should be possible to map columns with parameters relying just on their names.

0reactions
geralt-encorecommented, Jan 3, 2017

That’s a bummer 😔 I tested it properly before making PR with the fix and it worked. Need to investigate it further…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found