You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following code. The two classes ImmutableIntList1 and ImmutableIntList2 have the same logic and control flow, but the Nullness Checker issues an error message for the first but not the second:
Issue3622.java:14: error: [contracts.conditional.postcondition.not.satisfied] conditional postcondition is not satisfied when equals returns true.
return obj instanceof ImmutableIntList1 ? true : obj instanceof List;
^
found : obj is @Nullable
required: obj is @NonNull
// Test case for https://tinyurl.com/cfissue/3622// @skip-test until the issue is fixedimportjava.util.List;
importorg.checkerframework.checker.nullness.qual.Nullable;
publicclassIssue3622 {
publicclassImmutableIntList1 {
@Overridepublicbooleanequals(@NullableObjectobj) {
returnobjinstanceofImmutableIntList1 ? true : objinstanceofList;
}
}
publicclassImmutableIntList2 {
@Overridepublicbooleanequals(@NullableObjectobj) {
if (objinstanceofImmutableIntList2) {
returntrue;
} else {
returnobjinstanceofList;
}
}
}
}
The text was updated successfully, but these errors were encountered:
Consider the following code. The two classes
ImmutableIntList1
andImmutableIntList2
have the same logic and control flow, but the Nullness Checker issues an error message for the first but not the second:The text was updated successfully, but these errors were encountered: