mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-08 21:52:48 +07:00
Fixes IDEA-351947 False positive warning 'Nullability and data flow problems' in readResolve GitOrigin-RevId: 26c71c3e26c087334741a5a098812f91144bdcd4
31 lines
900 B
Java
31 lines
900 B
Java
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.io.*;
|
|
import java.util.Base64;
|
|
|
|
class Test implements Serializable {
|
|
@NotNull String string;
|
|
|
|
Test(@NotNull String string) {
|
|
this.string = string;
|
|
}
|
|
|
|
@Serial
|
|
private void readObject(ObjectInputStream in) throws IOException {
|
|
this.string = in.readUTF();
|
|
}
|
|
|
|
@Serial
|
|
protected Object readResolve() {
|
|
if (<warning descr="Condition 'string == null' is always 'false'">string == null</warning>) {
|
|
throw new IllegalStateException("Wrong object!");
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public static void main(String[] args) throws IOException, ClassNotFoundException {
|
|
byte[] data = Base64.getDecoder().decode("rO0ABXNyAARUZXN0ST9d8XKvH/0CAAFMAAZzdHJpbmd0ABJMamF2YS9sYW5nL1N0cmluZzt4cHA=");
|
|
Test object = (Test) new ObjectInputStream(new ByteArrayInputStream(data)).readObject();
|
|
System.out.println(object);
|
|
}
|
|
} |