ClassFileAnalyzer (Can)
Home

 

Example: TestCanField

Test directive .field

 

/* TestCanField.java */

public class TestCanField {

  int i = 123;
  long l = 456;
  float f = 1.23e12f;
  double d = 4.56e34d;
  
  String s = "Hallo";
  
  double[][] darray = { {1.2d, 3.4d}, {5.6d, 7.8d} };
  
  private static final int iconst = 3;
  private static final long lconst = 2147483648L;
  private static final float fconst = 12.34f;
  private static final double dconst = 3.5E38;
  private static final String sconst = "String constant";
}

 

> javac TestCanField.java
> java ClassFileAnalyzer TestCanField.class

 

; TestCanField.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 TestCanField.java
.class public TestCanField
.super java/lang/Object

.field i I
.field l J
.field f F
.field d D
.field s Ljava/lang/String;
.field darray [[D
.field private static final iconst I = 3
.field private static final lconst J = 2147483648
.field private static final fconst F = 12.34
.field private static final dconst D = 3.5E38
.field private static final sconst Ljava/lang/String; = "String constant"

.method public <init>()V
  .limit stack 9
  .limit locals 1
  .line 3
  0: aload_0
  1: invokespecial java/lang/Object/<init>()V
  .line 5
  4: aload_0
  5: bipush 123
  7: putfield TestCanField/i I
  .line 6
  10: aload_0
  11: ldc2_w 456
  14: putfield TestCanField/l J
  .line 7
  17: aload_0
  18: ldc 1.22999996E12
  20: putfield TestCanField/f F
  .line 8
  23: aload_0
  24: ldc2_w 4.56E34
  27: putfield TestCanField/d D
  .line 10
  30: aload_0
  31: ldc "Hallo"
  33: putfield TestCanField/s Ljava/lang/String;
  .line 12
  36: aload_0
  37: iconst_2
  38: anewarray [D
  41: dup
  42: iconst_0
  43: iconst_2
  44: newarray double
  46: dup
  47: iconst_0
  48: ldc2_w 1.2
  51: dastore
  52: dup
  53: iconst_1
  54: ldc2_w 3.4
  57: dastore
  58: aastore
  59: dup
  60: iconst_1
  61: iconst_2
  62: newarray double
  64: dup
  65: iconst_0
  66: ldc2_w 5.6
  69: dastore
  70: dup
  71: iconst_1
  72: ldc2_w 7.8
  75: dastore
  76: aastore
  77: putfield TestCanField/darray [[D
  80: return
.end method