Skip to content

Fix Nullwarnings - A#14116

Merged
koppor merged 8 commits into
mainfrom
nullwarnings
Nov 14, 2025
Merged

Fix Nullwarnings - A#14116
koppor merged 8 commits into
mainfrom
nullwarnings

Conversation

@calixtus

@calixtus calixtus commented Oct 19, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@koppor koppor left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@calixtus calixtus marked this pull request as ready for review November 14, 2025 17:35
@koppor koppor enabled auto-merge November 14, 2025 19:50
@koppor koppor added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit 4e8d537 Nov 14, 2025
51 of 52 checks passed
@koppor koppor deleted the nullwarnings branch November 14, 2025 20:28
Siedlerchr added a commit that referenced this pull request Nov 15, 2025
…ersions/org.glassfish.jersey.core-jersey-server-4.0.0

* upstream/main: (31 commits)
  Adds a 'regenerate' button to AI chat tab (#12191) (#14191)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (#14323)
  Update dependency com.konghq:unirest-modules-gson to v4.6.0 (#14322)
  Convert fixed-value ComboBoxes to SearchableComboBox (#14083) (#14165)
  Add support for transliterated citation keys (#13893)
  Update dependency org.apache.maven.plugins:maven-jar-plugin to v3.5.0 (#14321)
  Add link to latest development version (#14320)
  Parameterize tests in AuthorTest and AuthorListTest (#14135)
  Add AGENTS.md and AI_USAGE_POLICY.md from p5.js (#14316)
  Fix Nullwarnings - A (#14116)
  Update io.github.darvil82:terminal-text-formatter from 2.2.0 to 2.3.0c (#14317)
  Streamline maven repositories (#14315)
  Fix paths to included Java sources
  Add forgotten ..
  Update dependency io.github.darvil82:terminal-text-formatter to v2.3.0c (#14314)
  Chore(deps): Bump io.github.classgraph:classgraph from 4.8.181 to 4.8.184 in /versions (#14304)
  Chore(deps): Bump com.fasterxml:aalto-xml in /versions (#14311)
  Chore(deps): Bump commons-io:commons-io in /versions (#14310)
  Chore(deps): Bump org.apache.maven.plugins:maven-surefire-plugin (#14298)
  Disable fetcher-gui-test (#14308)
  ...
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
* Fix some null warnings

* Remove artifact

* Fix nullwarnings in FetcherException ISIDOREFetcher and ResearchGate

* Undo newline

* Introduce constant

* Add link to related classes

---------

Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
@calixtus calixtus mentioned this pull request Jan 4, 2026
2 tasks
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.

3 participants