Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

404
Vistas
Kotlin @FunctionalInterface compiles with multiple abstract methods

When trying to compile a Java @FunctionalInterface having more than 1 non-abstract method a compilation error is raised.

However, when doing the same in Kotlin, no errors or warnings are raised, i.e. the following Kotlin interface compiles successfully:

@FunctionalInterface
interface Foo {
    fun foo()
    fun foo(params: Map<String, String>)
}

Is this the intended behaviour or a bug in the Kotlin compiler?

Please note that the generated bytecode for the above Kotlin snippet is equivalent to the following Java snippet (which – correctly – doesn't compile):

@FunctionalInterface
// metadata omitted
public interface Foo {
   void foo();
   void foo(@NotNull Map var1);
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Issue KT-25512 has been submitted to JetBrains's issue tracker (by another user) to report the fact that the compiler misbehaves when @FunctionalInterface is applied to a non-SAM interface, and as of 10 Feb 2019 the issue is still open with no activity.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda