Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9114

Groovy chooses inline reified method over standard from Kotlin class

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5.x
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      Given kotlin class with two methods:

      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)
      
      

      and used from groovy as:

      def id = pathParam("id)

      Groovy for some reason chooses inline reified version, which of course fails with: 

      java.lang.UnsupportedOperationException: This function has a reified type parameter and thus can only be inlined at compilation time, not called directly.

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ernestas Ernestas
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: