You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Ernestas (JIRA)" <ji...@apache.org> on 2019/05/09 06:52:00 UTC

[jira] [Created] (GROOVY-9114) Groovy chooses inline reified method over standard from Kotlin class

Ernestas created GROOVY-9114:
--------------------------------

             Summary: 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


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}
In result groovy executes 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)