import java.util.*;
import org.jetbrains.annotations.*;
class Test {
record MyRecord(int value) {}
void testRecord(MyRecord record) {
if (record.value() == 0) {
if (record.value == 0) {}
}
}
void testPoint(Point p1, Point p2) {
if (p1.x == p2.x) {
if (p1.getX() != p2.getX()) {
}
if (p1.getXBoxed() == null) {}
if (p1.getXBoxed() != p2.getXBoxed()) {
}
}
p2.y = 5;
if (p2.getY() > 0) {}
}
void testWithNullity(WithNullity w) {
if (w.getS() == null) {
}
// Not inlined, because method is declared as nullable, while field is not
System.out.println(w.getS2().trim());
// Inlined, nullability is taken from the field (optional warning inside the method)
System.out.println(w.getS3().trim());
// Inlined, not-null nullability is forced by method declaration (but we have a warning inside the method)
System.out.println(w.getS4().trim());
}
static final class WithNullity {
String s;
String s2;
@Nullable String s3;
@Nullable String s4;
@NotNull
String getS() {
return s;
}
@Nullable
String getS2() {
return s2;
}
String getS3() {
return s3;
}
@NotNull
String getS4() {
return s4;
}
}
static final class Point {
int x, y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
int getX() {
return x;
}
int getY() {
return y;
}
Integer getXBoxed() { // Boxing should not be supported intentionally
return x;
}
}
}