[ https://issues.apache.org/jira/browse/GROOVY-9114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16839579#comment-16839579 ]
Ernestas edited comment on GROOVY-9114 at 5/14/19 3:58 PM: ----------------------------------------------------------- Thanks [~blackdrag], very insightful information you've provided! I'll also raise this issue in Kotlin bug tracker, since they've multiple open questions regarding inline reified methods (such as: whether they should make it public, whether they should generate it at all, etc). Then I'll come back with more information. Afaik, by design, inline reified methods should not be available as a separate method and should be inlined. was (Author: ernestas): Thanks [~blackdrag], very insightful information you've provided. I'll also raise this issue in Kotlin bug tracker, since they've multiple open questions regarding inline reified methods (such as: whether they should make it public, whether they should generate it at all, etc). Then I'll come back with more information. Afaik, by design, inline reified methods should not be available as a separate method and should be inlined. > 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)