Skip to content

Conversation

@calixtus
Copy link
Member

@calixtus calixtus commented Oct 19, 2025

Self describing.
Removed also artifact from #13867

Feel free to pick some classes and push some commits with null fixes to this PR.

Steps to test

Run gradle :jablib:build, see if null warnings have bin fixed.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [.] I manually tested my changes in running JabRef (always required)
  • [.] I added JUnit tests for changes (if applicable)
  • [.] I added screenshots in the PR description (if change is visible to the user)
  • [.] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [.] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@calixtus calixtus added the dev: code-quality Issues related to code or architecture decisions label Oct 19, 2025

applyFilter(request.filter()).forEach(id -> {
EmbeddingRecord eRecord = embeddingsMap.get(id);
EmbeddingRecord eRecord = embeddingsMap.getOrDefault(id, new EmbeddingRecord(null, "", new float[0]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could think about a NULL_OBJECT constant

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NULL_OBJECT would also help here to avoid memory increase on all executions of this line. Reason: The fall-back object is created on all calls, even propbably never (!) used. --> we never had NPEs here, had we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed somewhere else?

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should discuss the comments here, get this in and do other null fixes later. The fixes should get in ASAP - and not pile up.


applyFilter(request.filter()).forEach(id -> {
EmbeddingRecord eRecord = embeddingsMap.get(id);
EmbeddingRecord eRecord = embeddingsMap.getOrDefault(id, new EmbeddingRecord(null, "", new float[0]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NULL_OBJECT would also help here to avoid memory increase on all executions of this line. Reason: The fall-back object is created on all calls, even propbably never (!) used. --> we never had NPEs here, had we?

DAY("day"),
DAYFILED("dayfiled"),
DOI("doi", "DOI", FieldProperty.VERBATIM, FieldProperty.IDENTIFIER),
DOI("doi", FieldProperty.VERBATIM, FieldProperty.IDENTIFIER),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG, maybe you found a core issue in JabRef's code here?

With #13867 it seems a large architectural change has been introduced. org.jabref.model.entry.field.FieldTextMapper is now used instead of .getDisplayName(). We should decide whether we want to have the DisplayName close to the field or at some other class. - I first thought that org.jabref.model.entry.field.FieldTextMapper was UI, but it is logic (because of usage by OO code).

I am a bit undecided where to put. I found the "old" way to have it annoted at the field itself better. One could argue to have the field information more lightweight and display is another concern. --> We should link org.jabref.model.entry.field.FieldTextMapper in StandardField

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had the discussion if I recall correctly. We opted then for a clean separation of ui layer and internal representation.

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Nov 14, 2025
@calixtus
Copy link
Member Author

Im okay with merging asap. We can make a series of null fix prs. Maybe also nice good first issues? Needs some thinking though.

@calixtus
Copy link
Member Author

Will introduce null obj constant later today. After that rfr.

protected MVStore mvStore;

public MVStoreBase(@Nullable Path path, NotificationService dialogService) {
public MVStoreBase(@NonNull Path path, NotificationService dialogService) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but didn't it was nullable on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiler says now "no". 😄
But seriously: I see in calling methods only call to getAiFilesDirectory

grafik

which should always be not null:
grafik

On the otherside inside the method contract of Files.createDirectories Path argument is NotNull
grafik
grafik

@calixtus calixtus changed the title Fix Nullwarnings Fix Nullwarnings - A Nov 14, 2025
@calixtus calixtus added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 14, 2025
@calixtus calixtus requested review from InAnYan and koppor November 14, 2025 14:48
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev: code-quality Issues related to code or architecture decisions status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants