ClassFileAnalyzer (Can)
Home

 

Example: TestCanAnnotationDefault

Test directive .annotation default

 

/* TestCanAnnotationDefault.java */ 

import java.lang.annotation.*;

@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.ANNOTATION_TYPE,
                  ElementType.CONSTRUCTOR,
                  ElementType.FIELD,
                  ElementType.LOCAL_VARIABLE,
                  ElementType.METHOD,
                  ElementType.PACKAGE,
                  ElementType.PARAMETER,
                  ElementType.TYPE 
                })

public @interface TestCanAnnotationDefault {
  byte byteValue() default 1;
  char[] charValue() default { 'a', 'b' };
  double doubleValue() default 1.23;
  float floatValue() default 2.34f;
  int[] intValue() default { 2, 3, 4 };
  long longValue() default 5;
  short shortValue() default 6;
  boolean[] booleanValue() default { true, true, false };
  String[] stringValue() default { "Hello", "Clara!" };
}

 

> javac TestCanAnnotationDefault.java
> java ClassFileAnalyzer TestCanAnnotationDefault.class

 

; TestCanAnnotationDefault.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 TestCanAnnotationDefault.java
.interface public abstract annotation TestCanAnnotationDefault
.super java/lang/Object
.implements java/lang/annotation/Annotation
.annotation visible Ljava/lang/annotation/Retention;
  value e Ljava/lang/annotation/RetentionPolicy; = RUNTIME
  .end annotation
.annotation visible Ljava/lang/annotation/Target;
  ; one line
  value [e Ljava/lang/annotation/ElementType; = ANNOTATION_TYPE CONSTRUCTOR
          FIELD LOCAL_VARIABLE METHOD PACKAGE PARAMETER TYPE
  .end annotation

.method public abstract byteValue()B
  .annotation default
    B = 1
    .end annotation
.end method

.method public abstract charValue()[C
  .annotation default
    [C = 97 98
    .end annotation
.end method

.method public abstract doubleValue()D
  .annotation default
    D = 1.2300000190734863
    .end annotation
.end method

.method public abstract floatValue()F
  .annotation default
    F = 2.34
    .end annotation
.end method

.method public abstract intValue()[I
  .annotation default
    [I = 2 3 4
    .end annotation
.end method

.method public abstract longValue()J
  .annotation default
    J = 5
    .end annotation
.end method

.method public abstract shortValue()S
  .annotation default
    S = 6
    .end annotation
.end method

.method public abstract booleanValue()[Z
  .annotation default
    [Z = 1 1 0
    .end annotation
.end method

.method public abstract stringValue()[Ljava/lang/String;
  .annotation default
    [s = "Hello" "Clara!"
    .end annotation
.end method