https://kotlinlang.org logo
#announcements
Title
# announcements
m

Marcelus Trojahn

07/30/2019, 3:38 PM
I cant figure out how to pass that viewClass variable as parameter to setRoute... No matter what I do it always complains its the wrong type.
m

mbonnin

07/30/2019, 3:38 PM
Target::class.java ?
m

Marcelus Trojahn

07/30/2019, 3:39 PM
Already tried every single combination of that
1
::class, ::class.java... ::kotlin... everything hehe
r

ruialonso

07/30/2019, 3:41 PM
use
reified
m

Marcelus Trojahn

07/30/2019, 3:42 PM
also tried that
apparently no matter what, it always match the first 2 methods on that list
never matches the 3rd or 4th
see, passing a KClass to the method and it requires a Router! It doesn't match the other overrides.
m

mbonnin

07/30/2019, 3:47 PM
maybe it's an IDE thing and it compiles fine ?
m

Marcelus Trojahn

07/30/2019, 3:47 PM
nope
it is starting to really piss me off 🙂
r

ruialonso

07/30/2019, 4:02 PM
Screenshot 2019-07-30 at 18.02.27.png
maybe is something about dependencies configuration
m

Marcelus Trojahn

07/30/2019, 4:04 PM
yeah... I think something with that DSL routerLink
k

karelpeeters

07/30/2019, 4:32 PM
Are you sure the last two aren't defined elsewhere and need to be explicitly imported?
m

Marcelus Trojahn

07/30/2019, 4:34 PM
well, they are defined by that DSL that is enclosing everything there "routerLink". So I suppose they should be derived from "this" there. But I'm starting to doubt that too
k

karelpeeters

07/30/2019, 4:35 PM
Try pressing enter on them in the suggestion box.
m

Marcelus Trojahn

07/30/2019, 4:35 PM
nothing out of the ordinary... just let me start typing
val foo = routerLink(icon, caption) foo.setRoute(viewClass)
this works...
its the 3rd override on the screenshot
image.png
once I add "parameter" then both parameters are invalid
ok i kinda figured it out... the viewClass has to implement HasUrlParameter to match the override I want... If I type the class name it works, if it comes from the variable the compiler cant figure it out, I guess
fixed.. a lil hacky but working. thanks for help.
2 Views