Created
February 5, 2025 15:34
-
-
Save AungThiha/6e7de0cb845890f24b396c7c3e5f22f9 to your computer and use it in GitHub Desktop.
Top-level Constants vs Companion-enclosed Constants in Kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .class public final Lcom/example/myapplication/MainActivity$Companion; | |
| .super Ljava/lang/Object; | |
| .source "MainActivity.kt" | |
| # annotations | |
| .annotation system Ldalvik/annotation/EnclosingClass; | |
| value = Lcom/example/myapplication/MainActivity; | |
| .end annotation | |
| .annotation system Ldalvik/annotation/InnerClass; | |
| accessFlags = 0x19 | |
| name = "Companion" | |
| .end annotation | |
| # direct methods | |
| .method private constructor <init>()V | |
| .locals 0 | |
| .line 16 | |
| invoke-direct {p0}, Ljava/lang/Object;-><init>()V | |
| return-void | |
| .end method | |
| .method public synthetic constructor <init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V | |
| .locals 0 | |
| .line 0 | |
| invoke-direct {p0}, Lcom/example/myapplication/MainActivity$Companion;-><init>()V | |
| return-void | |
| .end method |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .class public final Lcom/example/myapplication/MainActivity; | |
| .super Landroidx/activity/ComponentActivity; | |
| .source "MainActivity.kt" | |
| # annotations | |
| .annotation system Ldalvik/annotation/MemberClasses; | |
| value = { | |
| Lcom/example/myapplication/MainActivity$Companion; | |
| } | |
| .end annotation | |
| .annotation runtime Lkotlin/Metadata; | |
| d1 = { | |
| "\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\u0018\u0000 \u00082\u00020\u0001:\u0001\u0008B\u0007\u00a2\u0006\u0004\u0008\u0002\u0010\u0003J\u0012\u0010\u0004\u001a\u00020\u00052\u0008\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0014\u00a8\u0006\t" | |
| } | |
| d2 = { | |
| "Lcom/example/myapplication/MainActivity;", | |
| "Landroidx/activity/ComponentActivity;", | |
| "<init>", | |
| "()V", | |
| "onCreate", | |
| "", | |
| "savedInstanceState", | |
| "Landroid/os/Bundle;", | |
| "Companion", | |
| "app_debug" | |
| } | |
| k = 0x1 | |
| mv = { | |
| 0x2, | |
| 0x1, | |
| 0x0 | |
| } | |
| xi = 0x30 | |
| .end annotation | |
| # static fields | |
| .field public static final Companion:Lcom/example/myapplication/MainActivity$Companion; | |
| # direct methods | |
| .method static constructor <clinit>()V | |
| .locals 2 | |
| .line 0 | |
| new-instance v0, Lcom/example/myapplication/MainActivity$Companion; | |
| const/4 v1, 0x0 | |
| invoke-direct {v0, v1}, Lcom/example/myapplication/MainActivity$Companion;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V | |
| sput-object v0, Lcom/example/myapplication/MainActivity;->Companion:Lcom/example/myapplication/MainActivity$Companion; | |
| return-void | |
| .end method | |
| .method public constructor <init>()V | |
| .locals 0 | |
| .line 8 | |
| invoke-direct {p0}, Landroidx/activity/ComponentActivity;-><init>()V | |
| return-void | |
| .end method | |
| # virtual methods | |
| .method protected onCreate(Landroid/os/Bundle;)V | |
| .locals 2 | |
| .param p1, "savedInstanceState" # Landroid/os/Bundle; | |
| .line 11 | |
| invoke-super {p0, p1}, Landroidx/activity/ComponentActivity;->onCreate(Landroid/os/Bundle;)V | |
| .line 12 | |
| const-string v0, "TOP_LEVEL_CONSTANT" | |
| sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream; | |
| invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V | |
| .line 13 | |
| const-string v0, "COMPANION_ENCLOSED_CONSTANT" | |
| sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream; | |
| invoke-virtual {v1, v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V | |
| .line 14 | |
| return-void | |
| .end method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment