Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin@FunctionInterface使用多个抽象方法进行编译_Kotlin_Functional Interface - Fatal编程技术网

Kotlin@FunctionInterface使用多个抽象方法进行编译

Kotlin@FunctionInterface使用多个抽象方法进行编译,kotlin,functional-interface,Kotlin,Functional Interface,当试图编译具有多个非抽象方法的Java@FunctionInterface时,会引发编译错误 但是,在Kotlin中执行相同操作时,不会出现任何错误或警告,即以下Kotlin接口编译成功: @FunctionalInterface interface Foo { fun foo() fun foo(params: Map<String, String>) } 问题已提交给JetBrains的问题跟踪器(由另一个用户提交),以报告当@functioninterface

当试图编译具有多个非抽象方法的Java
@FunctionInterface
时,会引发编译错误

但是,在Kotlin中执行相同操作时,不会出现任何错误或警告,即以下Kotlin
接口
编译成功:

@FunctionalInterface
interface Foo {
    fun foo()
    fun foo(params: Map<String, String>)
}
问题已提交给JetBrains的问题跟踪器(由另一个用户提交),以报告当
@functioninterface
应用于非SAM接口时编译器行为不当的事实,并且截至2019年2月10日,问题仍然没有活动

@FunctionalInterface
// metadata omitted
public interface Foo {
   void foo();
   void foo(@NotNull Map var1);
}