# Kotlin-Java interop: function references and SAM conversions

DevFeed: [Kotlin-Java interop: function references and SAM conversions](<https://devfeed.tech/articles/kotlin-java-interop-function-references-and-sam-conversions-38608.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2018_09_13_kotlin_java_interop_function_references_and_sam_conversions/>)

Published: 2018-09-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Java](<https://devfeed.tech/topics/java.md>), [callback](<https://devfeed.tech/topics/callback.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [callback](<https://devfeed.tech/tags/callback.md>), [function](<https://devfeed.tech/tags/function.md>), [interop](<https://devfeed.tech/tags/interop.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>)

## AI overview

This technical article explains a Kotlin-Java interoperability issue involving Kotlin function references and Java single-abstract-method (SAM) conversions. When the same function reference is passed to Java registration and removal methods, the generated callback instances can differ, so the callback may not be removed as expected.

## Source excerpt

Though all the things below are pretty obvious if being careful while dealing with Kotlin-Java interop, I decided still to write short note about one particular issue with function references (from Kotlin side) and SAM conversions (from Java side). Function reference Function reference is a good way to pass function as a parameter without explicitly using lambdas. For example, if we have function: fun method(callback: (Input) -> Output) { ... } then we can pass our function as a lambda with function call or as a function reference: