Skip to content

Instantly share code, notes, and snippets.

@khotyn
Created December 6, 2011 06:03
Show Gist options
  • Save khotyn/1436957 to your computer and use it in GitHub Desktop.
Save khotyn/1436957 to your computer and use it in GitHub Desktop.
What is AnnotationDefault in Java class file.
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AnnoMethod {
int id() default 9;
String value() default "Hello, world";
}
Compiled from "AnnoMethod.java"
public interface AnnoMethod extends java.lang.annotation.Annotation
SourceFile: "AnnoMethod.java"
RuntimeVisibleAnnotations: length = 0x1B
00 02 00 0E 00 01 00 08 65 00 0F 00 10 00 11 00
01 00 08 5B 00 01 65 00 12 00 13
minor version: 0
major version: 50
Constant pool:
const #1 = class #20; // AnnoMethod
const #2 = class #21; // java/lang/Object
const #3 = class #22; // java/lang/annotation/Annotation
const #4 = Asciz id;
const #5 = Asciz ()I;
const #6 = Asciz AnnotationDefault;
const #7 = int 9;
const #8 = Asciz value;
const #9 = Asciz ()Ljava/lang/String;;
const #10 = Asciz Hello, world;
const #11 = Asciz SourceFile;
const #12 = Asciz AnnoMethod.java;
const #13 = Asciz RuntimeVisibleAnnotations;
const #14 = Asciz Ljava/lang/annotation/Retention;;
const #15 = Asciz Ljava/lang/annotation/RetentionPolicy;;
const #16 = Asciz RUNTIME;
const #17 = Asciz Ljava/lang/annotation/Target;;
const #18 = Asciz Ljava/lang/annotation/ElementType;;
const #19 = Asciz METHOD;
const #20 = Asciz AnnoMethod;
const #21 = Asciz java/lang/Object;
const #22 = Asciz java/lang/annotation/Annotation;
{
public abstract int id();
AnnotationDefault: length = 0x3
49 00 07
public abstract java.lang.String value();
AnnotationDefault: length = 0x3
73 00 0A
}
@khotyn
Copy link
Author

khotyn commented Dec 6, 2011

AnnotationDefault represents a default value of a method in an Annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment