@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyAnnotation {
String value() default "hello";
}
@MyAnnotation("super")
class MySuper {
@MyAnnotation("t1")
public void t1() {
}
}
// Auto inherit MySuper's annotation
class MySub extends MySuper {
// Not inherit, you MUST explicitly declare
public void t1() {
}
}
Last active
February 19, 2020 00:14
-
-
Save vicly/f60bb467625b126e7a51b9d372b9d931 to your computer and use it in GitHub Desktop.
[Java annotation] #Java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment