Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4f9f9e2

Browse filesBrowse files
authored
BAEL-4233: Why doesn't a missing annotation cause a ClassNotFoundException at runtime? (eugenp#11024)
1 parent b8a05bc commit 4f9f9e2
Copy full SHA for 4f9f9e2

File tree

Expand file treeCollapse file tree

4 files changed

+31
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+31
-0
lines changed
Open diff view settings
Collapse file
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.baeldung.missingannotation;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.RetentionPolicy;
5+
6+
@Retention(RetentionPolicy.RUNTIME)
7+
public @interface A {
8+
}
Collapse file
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.baeldung.missingannotation;
2+
3+
@A
4+
@C(D.class)
5+
public class B {
6+
7+
public static void main(String[] args) {
8+
System.out.println("It worked");
9+
}
10+
}
Collapse file
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.missingannotation;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.RetentionPolicy;
5+
6+
@Retention(RetentionPolicy.RUNTIME)
7+
public @interface C {
8+
Class<?> value();
9+
}
Collapse file
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.baeldung.missingannotation;
2+
3+
public class D {
4+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.