BAEL-4233: Why doesn't a missing annotation cause a ClassNotFoundException at runtime? (#11024)

This commit is contained in:
Ali Dehghani 2021-07-18 20:13:45 +04:30 committed by GitHub
parent d2035e86af
commit 81fddd7bc3
4 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package com.baeldung.missingannotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface A {
}

View File

@ -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");
}
}

View File

@ -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();
}

View File

@ -0,0 +1,4 @@
package com.baeldung.missingannotation;
public class D {
}