Check signature

Use javap to check the signature of class with debug build.

$ javap -help
Usage: javap <options> <classes>
where possible options include:
  -help  --help  -?        Print this usage message
  -version                 Version information
  -v  -verbose             Print additional information
  -l                       Print line number and local variable tables
  -public                  Show only public classes and members
  -protected               Show protected/public classes and members
  -package                 Show package/protected/public classes
                           and members (default)
  -p  -private             Show all classes and members
  -c                       Disassemble the code
  -s                       Print internal type signatures
  -sysinfo                 Show system info (path, size, date, MD5 hash)
                           of class being processed
  -constants               Show final constants
  -classpath <path>        Specify where to find user class files
  -cp <path>               Specify where to find user class files
  -bootclasspath <path>    Override location of bootstrap class files
$ cd /Users/HSY/Desktop/NativeDemo/app/build/tmp/kotlin-classes/debug
ses HSY$ cd debug/
$ javap -s -p com.practice.Counter
Compiled from "Counter.kt"
public final class com.practice.Counter {
  private int count;
    descriptor: I
  private static final java.lang.String NAME;
    descriptor: Ljava/lang/String;
  public static final com.practice.Counter$Companion Companion;
    descriptor: Lcom/practice/Counter$Companion;
  public final void add();
    descriptor: ()V

  public final int count();
    descriptor: ()I

  public com.practice.Counter();
    descriptor: ()V

  static {};
    descriptor: ()V

  public static final int access$getCount$p(com.practice.Counter);
    descriptor: (Lcom/practice/Counter;)I

  public static final void access$setCount$p(com.practice.Counter, int);
    descriptor: (Lcom/practice/Counter;I)V
}
  • Counter.kt

    package com.practice
    
    class Counter {
    
        companion object {
            private const val NAME = "kkbox"
    
            fun getName(): String {
                return NAME
            }
        }
    
        private var count = 0
    
        fun add() {
            count++
        }
    
        fun count(): Int {
            return count
        }
    
        inner class Comparator(val name: String) {
    
            fun isSameAs(num: Int): Boolean {
                return num == count
            }
        }
    }
    
  • for inner class

    $ javap -s -p com/practice/Counter\$Comparator.class 
    Compiled from "Counter.kt"
    public final class com.practice.Counter$Comparator {
      private final java.lang.String name;
        descriptor: Ljava/lang/String;
      final com.practice.Counter this$0;
        descriptor: Lcom/practice/Counter;
      public final boolean isSameAs(int);
        descriptor: (I)Z
    
      public final java.lang.String getName();
        descriptor: ()Ljava/lang/String;
    
      public com.practice.Counter$Comparator(java.lang.String);
        descriptor: (Lcom/practice/Counter;Ljava/lang/String;)V
    }
    

results matching ""

    No results matching ""