[ https://issues.apache.org/jira/browse/GROOVY-9114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16839599#comment-16839599 ]
Alexander Udalov edited comment on GROOVY-9114 at 5/14/19 4:26 PM: ------------------------------------------------------------------- In fact, we do have plans to avoid generating inline reified functions into private JVM methods in Kotlin, see [https://youtrack.jetbrains.com/issue/KT-18563]. So, in the next (hopefully) Kotlin version this method will be generated as public but synthetic (with the ACC_SYNTHETIC flag). Maybe the issue will be fixed automatically after that, since I hope the resolution in Groovy never chooses synthetic methods? However maybe it's still better to fix this one, to improve Groovy behavior against classes compiled by older versions of Kotlin. > Afaik, by design, inline reified methods should not be available as a > separate method and should be inlined. [~ernestas] this is not entirely correct; public inline reified methods can be used from other modules, this is why we still need to retain a public method in the classfile. was (Author: udalov): In fact, we do have plans to avoid generating inline reified functions into private JVM methods in Kotlin, see [https://youtrack.jetbrains.com/issue/KT-18563]. So, in the next (hopefully) Kotlin version this method will be generated as public but synthetic (with the ACC_SYNTHETIC flag). Maybe the issue will be fixed automatically after that, since I hope the resolution in Groovy never chooses synthetic methods? However maybe it's still better to fix this one, to improve Groovy behavior against classes compiled by older versions of Kotlin. > Afaik, by design, public inline reified methods should not be available as a > separate method and should be inlined. [~ernestas] this is not entirely correct; inline reified methods can be used from other modules, this is why we still need to retain a public method in the classfile. > Groovy chooses inline reified method over standard from Kotlin class > --------------------------------------------------------------------- > > Key: GROOVY-9114 > URL: https://issues.apache.org/jira/browse/GROOVY-9114 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Affects Versions: 2.5.x > Reporter: Ernestas > Priority: Major > > Given kotlin class with two methods: > {code:java} > fun pathParam(key: String): String = > ContextUtil.pathParamOrThrow(pathParamMap, key, matchedPath) > > /** Reified version of [pathParam] (Kotlin only) */ > inline fun <reified T : Any> pathParam(key: String) = pathParam(key, > T::class.java) > {code} > and used from groovy as: > {code:java} > def id = pathParam("id){code} > Groovy for some reason chooses inline reified version, which of course fails > with: > {noformat} > java.lang.UnsupportedOperationException: This function has a reified type > parameter and thus can only be inlined at compilation time, not called > directly.{noformat} > Is there anything that can be done so groovy uses the first (non reified, > understandable by java and groovy) version of the method? > > This bug comes from [https://github.com/tipsy/javalin/issues/574] -- This message was sent by Atlassian JIRA (v7.6.3#76005)