If it define the following annotation:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MyAnnot {
public String value();
}
And then use it defining the following interface:
@MyAnnot("somevalue")
public interface MyClass
{
}
If I then run the following commands:
javac MyClass.java
javap MyClass.class
Then my output is:
Compiled from "MyClass.java"
public interface MyClass { }
So it appears to me that the annotation does not get retained? If this is so why is this the case?