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

157
Vistas
Does Kotlin generated byte code affect the method count?

For example, if I use

methodReference = ::method

rather than

methodReference = { method(it) }

decompiled code will contain getOwner, getName, getSignature methods in Java code, due to reflection. Do these methods counted against 64k limit ?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The methods are counted, only if they are not removed by proguard/R8

An example

  fun method(t : Any) {}
  val reference1: KFunction1<Any, Unit> = ::method
  val reference2: (Any) -> Unit = { method(it) }

For the reference1 the bytecode (decompiled to Java) would be:

   @NotNull
   final KFunction reference1 = new Function1((X)this) {
      // $FF: synthetic method
      // $FF: bridge method
      public Object invoke(Object var1) {.. }
      public final void invoke(@NotNull Object p1) {..}
      public final KDeclarationContainer getOwner() {..}
      public final String getName() {..}
      public final String getSignature() {..}
   };

for the lambda (or reference2) the equivalent java code is:

   @NotNull
   final Function1 reference2 = (Function1)(new Function1() {
      // $FF: synthetic method
      // $FF: bridge method
      public Object invoke(Object var1) {..}
      public final void invoke(@NotNull Object it) {..}
   });

So the difference is 4 +1 for method reference and 1 +1 for lambda, where +1 comes from the the bridge method invoke(t:Any)

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