Skip to content

Commit 379f243

Browse files
committed
Add test checking that inheritence is noticed even with annotations present
1 parent ab3cad7 commit 379f243

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.io.*;
2+
import java.lang.annotation.*;
3+
4+
public class Test {
5+
6+
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
7+
@interface NotNull { }
8+
9+
public static void test() {
10+
11+
OutputStream stream = new OutputStream() {
12+
@Override
13+
public void write(int b) throws IOException {
14+
OutputStream otherStream = null;
15+
otherStream.write(1);
16+
}
17+
@Override
18+
public void write(byte @NotNull [] b, int off, int len) throws IOException { // GOOD: even with the annotation @NotNull, this overrides write(byte[], int, int).
19+
}
20+
};
21+
22+
}
23+
24+
}

0 commit comments

Comments
 (0)