BAEL-4233: Why doesn't a missing annotation cause a ClassNotFoundException at runtime? (#11024)
This commit is contained in:
parent
d2035e86af
commit
81fddd7bc3
|
@ -0,0 +1,8 @@
|
|||
package com.baeldung.missingannotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface A {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.baeldung.missingannotation;
|
||||
|
||||
@A
|
||||
@C(D.class)
|
||||
public class B {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("It worked");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.baeldung.missingannotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface C {
|
||||
Class<?> value();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.baeldung.missingannotation;
|
||||
|
||||
public class D {
|
||||
}
|
Loading…
Reference in New Issue