2

When examining the content of a .class file from a Kotlin source (just "Hello World", nothing else) I found an UTF-8 string within the constant pool that is (a) not used anywhere and (b) with strange content.

Can any tell me what this is?

enter image description here

Christian
  • 576
  • 1
  • 4
  • 16

1 Answers1

5

This is the content of kotlin.Metadata annotation. It is coded with Protobuf and used by both compiler and Kotlin-Reflect.

Kotlin uses String instead of byte[] because class format is very wasteful at storing arrays.

When you are not using Kotlin-Reflect, metadata is unused and can be removed by ProGuard.

Miha_x64
  • 5,973
  • 1
  • 41
  • 63