Skip to content

Commit 7d48050

Browse files
authored
Replace "maybenull" by annotation (#11947)
1 parent 09e2585 commit 7d48050

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/main/java/org/jabref/model/database/BibDatabase.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import com.google.common.eventbus.EventBus;
4040
import com.google.common.eventbus.Subscribe;
41+
import org.jspecify.annotations.Nullable;
4142
import org.slf4j.Logger;
4243
import org.slf4j.LoggerFactory;
4344

@@ -87,13 +88,13 @@ public BibDatabase() {
8788
/**
8889
* Returns a text with references resolved according to an optionally given database.
8990
*
90-
* @param toResolve maybenull The text to resolve.
91-
* @param database maybenull The database to use for resolving the text.
91+
* @param toResolve The text to resolve.
92+
* @param database The database to use for resolving the text.
9293
* @return The resolved text or the original text if either the text or the database are null
9394
* @deprecated use {@link BibDatabase#resolveForStrings(String)}
9495
*/
9596
@Deprecated
96-
public static String getText(String toResolve, BibDatabase database) {
97+
public static String getText(@Nullable String toResolve, @Nullable BibDatabase database) {
9798
if ((toResolve != null) && (database != null)) {
9899
return database.resolveForStrings(toResolve);
99100
}

src/main/java/org/jabref/model/entry/BibEntry.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.google.common.eventbus.EventBus;
5151
import com.tobiasdiez.easybind.EasyBind;
5252
import com.tobiasdiez.easybind.optional.OptionalBinding;
53+
import org.jspecify.annotations.Nullable;
5354
import org.slf4j.Logger;
5455
import org.slf4j.LoggerFactory;
5556

@@ -309,22 +310,21 @@ private Optional<Field> getSourceField(Field targetField, EntryType targetEntry,
309310
* If a database is given, this function will try to resolve any string
310311
* references in the field-value.
311312
* Also, if a database is given, this function will try to find values for
312-
* unset fields in the entry linked by the "crossref" field, if any.
313+
* unset fields in the entry linked by the "crossref" ({@link StandardField#CROSSREF} field, if any.
313314
*
314315
* @param field The field to return the value of.
315-
* @param database maybenull
316-
* The database of the bibtex entry.
316+
* @param database The database of the bibtex entry.
317317
* @return The resolved field value or null if not found.
318318
*/
319-
public Optional<String> getResolvedFieldOrAlias(Field field, BibDatabase database) {
319+
public Optional<String> getResolvedFieldOrAlias(Field field, @Nullable BibDatabase database) {
320320
return genericGetResolvedFieldOrAlias(field, database, BibEntry::getFieldOrAlias);
321321
}
322322

323-
public Optional<String> getResolvedFieldOrAliasLatexFree(Field field, BibDatabase database) {
323+
public Optional<String> getResolvedFieldOrAliasLatexFree(Field field, @Nullable BibDatabase database) {
324324
return genericGetResolvedFieldOrAlias(field, database, BibEntry::getFieldOrAliasLatexFree);
325325
}
326326

327-
private Optional<String> genericGetResolvedFieldOrAlias(Field field, BibDatabase database, BiFunction<BibEntry, Field, Optional<String>> getFieldOrAlias) {
327+
private Optional<String> genericGetResolvedFieldOrAlias(Field field, @Nullable BibDatabase database, BiFunction<BibEntry, Field, Optional<String>> getFieldOrAlias) {
328328
if ((InternalField.TYPE_HEADER == field) || (InternalField.OBSOLETE_TYPE_HEADER == field)) {
329329
return Optional.of(type.get().getDisplayName());
330330
}

0 commit comments

Comments
 (0)