-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
I use JSpecify annotations and @NullMarked at module level. That means all parameters not explicitly marked as @Nullable (or for example defined in a @NullUnmarked class) are non-nullable by default.
I use @RecordBuilder.Options(nullableAnnotationClass = "org.jspecify.annotations.Nullable") on a record class like this:
@RecordBuilder
@JsonIgnoreProperties(ignoreUnknown = true)
@RecordBuilder.Options(nullableAnnotationClass = "org.jspecify.annotations.Nullable")
public record ComparisonConfiguration(
@Nullable Path pathA,
@Nullable Path pathB,
@Nullable Path pathOutput,
@Nullable String filenameReport,
@Nullable String patternFilename,
boolean updateInBackground,
boolean writeReport,
boolean useRelativePathForFilesInOutputFolder,
boolean extractSections,
boolean trimLines,
boolean ignoreWhitespace,
boolean inlineDiffByWord,
int contextLinesBefore,
int contextLinesAfter,
List<com.dua3.utility.text.FontDef> sectionFonts,
List<Substitution> substitutions
) implements ComparisonConfigurationBuilder.With { ... }
RecorBuilder generates this code for equals():
@Generated("io.soabase.recordbuilder.core.RecordBuilder")
@Override
public boolean equals(Object o) { ... }
But it should use the nullable annotation like this because equals() by contract must accept null and x.equals(null) == false for all x != null:
@Generated("io.soabase.recordbuilder.core.RecordBuilder")
@Override
public boolean equals(org.jspecify.annotations.@Nullable Object o) { ... }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels