Add test checking that inheritence is noticed even with annotations present

This commit is contained in:
Chris Smowton
2022-01-27 14:52:39 +00:00
parent ab3cad749c
commit 379f2438a6

View File

@@ -0,0 +1,24 @@
import java.io.*;
import java.lang.annotation.*;
public class Test {
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
@interface NotNull { }
public static void test() {
OutputStream stream = new OutputStream() {
@Override
public void write(int b) throws IOException {
OutputStream otherStream = null;
otherStream.write(1);
}
@Override
public void write(byte @NotNull [] b, int off, int len) throws IOException { // GOOD: even with the annotation @NotNull, this overrides write(byte[], int, int).
}
};
}
}