mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
25 lines
734 B
Java
25 lines
734 B
Java
import java.io.*;
|
|
import java.lang.annotation.*;
|
|
|
|
public class InefficientOutputStreamAnnotations {
|
|
|
|
@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).
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
}
|