ClassFileAnalyzer (Can)
Home

 

Example: TestCanInner

Test directive .inner

 

/* TestCanInner.java */

public class TestCanInner {

  public void methodOuter() {
    System.out.println("methodOuter");
    Inner inner = new Inner();
    inner.methodInner();
  }

  public class Inner {
    public void methodInner() {
      System.out.println("methodInner");
    }
  }

  public static void main(String[] args) {
     TestCanInner tci = new TestCanInner();
     tci.methodOuter();
  }
}

 

> javac TestCanInner.java
  --> TestCanInner.class, TestCanInner$Inner.class
  
> java ClassFileAnalyzer TestCanInner.class
> java ClassFileAnalyzer TestCanInner$Inner.class

 

; TestCanInner.j

; Generated by ClassFileAnalyzer (Can)
; Analyzer and Disassembler for Java class files
; (Jasmin syntax 2, http://jasmin.sourceforge.net)
;
; ClassFileAnalyzer, version 0.7.0 


.bytecode 50.0
.source TestCanInner.java
.class public TestCanInner
.super java/lang/Object
.inner class public Inner inner TestCanInner$Inner outer TestCanInner

.method public <init>()V
  .limit stack 1
  .limit locals 1
  .line 3
  0: aload_0
  1: invokespecial java/lang/Object/<init>()V
  .line 11
  4: return
.end method

.method public methodOuter()V
  .limit stack 3
  .limit locals 2
  .line 6
  0: getstatic java/lang/System/out Ljava/io/PrintStream;
  3: ldc "methodOuter"
  5: invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
  .line 7
  8: new TestCanInner$Inner
  11: dup
  12: aload_0
  13: invokespecial TestCanInner$Inner/<init>(LTestCanInner;)V
  16: astore_1
  .line 8
  17: aload_1
  18: invokevirtual TestCanInner$Inner/methodInner()V
  .line 9
  21: return
.end method

.method public static main([Ljava/lang/String;)V
  .limit stack 2
  .limit locals 2
  .line 18
  0: new TestCanInner
  3: dup
  4: invokespecial TestCanInner/<init>()V
  7: astore_1
  .line 19
  8: aload_1
  9: invokevirtual TestCanInner/methodOuter()V
  .line 20
  12: return
.end method

 

; TestCanInner$Inner.j

; Generated by ClassFileAnalyzer (Can)
; Analyzer and Disassembler for Java class files
; (Jasmin syntax 2, http://jasmin.sourceforge.net)
;
; ClassFileAnalyzer, version 0.7.0 


.bytecode 50.0
.source TestCanInner.java
.class public TestCanInner$Inner
.super java/lang/Object
.inner class public Inner inner TestCanInner$Inner outer TestCanInner

.field final synthetic this$0 LTestCanInner;

.method public <init>(LTestCanInner;)V
  .limit stack 2
  .limit locals 2
  .line 11
  0: aload_0
  1: aload_1
  2: putfield TestCanInner$Inner/this$0 LTestCanInner;
  5: aload_0
  6: invokespecial java/lang/Object/<init>()V
  9: return
.end method

.method public methodInner()V
  .limit stack 2
  .limit locals 1
  .line 13
  0: getstatic java/lang/System/out Ljava/io/PrintStream;
  3: ldc "methodInner"
  5: invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
  .line 14
  8: return
.end method