Skip to content

add toggle to disable built-in journal list#15387

Open
AnvitaPrasad wants to merge 4 commits intoJabRef:mainfrom
AnvitaPrasad:feature-disable-builtin-journal-list
Open

add toggle to disable built-in journal list#15387
AnvitaPrasad wants to merge 4 commits intoJabRef:mainfrom
AnvitaPrasad:feature-disable-builtin-journal-list

Conversation

@AnvitaPrasad
Copy link
Copy Markdown
Contributor

@AnvitaPrasad AnvitaPrasad commented Mar 22, 2026

Related issues and pull requests

Closes #12468

PR Description

This PR adds an option in the Journal Abbreviations preferences to disable the built-in JabRef journal abbreviation list. When unchecked, JabRef will not load its bundled list, allowing users to rely exclusively on their own custom lists.

The change is intentionally minimal, a single checkbox controls a new useBuiltInList preference that is persisted across restarts. When disabled, the loader skips the built-in journal-list.mv and initializes an empty repository instead.

Screenshot 2026-03-22 at 11 40 55 PM

Steps to test

To reproduce the problem on main:

  1. Open JabRef on the main branch.
  2. Go to Preferences, Journal abbreviations.
  3. Notice there is no way to disable the built-in JabRef journal list, it is always active.
  4. Add a custom abbreviation list.
  5. Both the built-in list and your custom list will be used simultaneously, there is no way to opt out of the built-in one.

To reproduce the fix on the feature branch:

  1. Switch to the feature-disable-builtin-journal-list branch and start JabRef.
  2. Go to Preferences , Journal abbreviations.
  3. You will see a new checkbox: "Use JabRef built-in journal abbreviation list" (checked by default).
  4. To verify the built-in list is active by default:
    • Add any entry (e.g. with journal field set to a full journal name like "Astrophysical Journal").
    • Run Quality , Abbreviate journal names , Default on that entry.
    • The journal name is abbreviated using the built-in list (e.g. "Astrophys. J.").
  5. Now uncheck "Use JabRef built-in journal abbreviation list" and click Save.
  6. Restart JabRef (preference is persisted).
  7. Run the same abbreviation step , the built-in list is no longer used, so abbreviations from it are no longer applied.
  8. If you add your own custom list under Preferences, Journal abbreviations, only that list will be used.
  9. Re-checking the checkbox and saving restores the built-in list.

Checklist

  • 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 added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

Copilot AI review requested due to automatic review settings March 22, 2026 18:43
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add toggle to disable built-in journal abbreviation list

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add checkbox to disable built-in journal abbreviation list
• Preference persists across application restarts
• Users can rely exclusively on custom journal lists
• Wired through preferences, loader, and UI components
Diagram
flowchart LR
  UI["UI Checkbox<br/>useBuiltInList"]
  VM["ViewModel Property<br/>useBuiltInListProperty"]
  PREFS["Preferences Storage<br/>useBuiltInList"]
  LOADER["Journal Loader<br/>shouldUseBuiltInList"]
  REPO["Repository<br/>Empty or Built-in"]
  
  UI -- "bidirectional<br/>binding" --> VM
  VM -- "store/load" --> PREFS
  PREFS -- "check preference" --> LOADER
  LOADER -- "conditional<br/>initialization" --> REPO
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java ✨ Enhancement +2/-0

Add UI checkbox binding for built-in list toggle

• Added useBuiltInList CheckBox FXML field
• Bound checkbox to ViewModel property bidirectionally

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java


2. jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java ✨ Enhancement +7/-0

Add ViewModel property for built-in list preference

• Added useBuiltInList SimpleBooleanProperty with default true
• Load preference value in setValues() method
• Store preference value in storeSettings() method
• Added public getter method useBuiltInListProperty()

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java


3. jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java ✨ Enhancement +21/-17

Conditionally load built-in journal list based on preference

• Wrapped built-in list loading logic in conditional check
• Skip loading built-in journal list when preference is disabled
• Initialize empty repository when preference is false
• Updated loadBuiltInRepository() to pass new preference parameter

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java


View more (5)
4. jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java ✨ Enhancement +16/-1

Add built-in list preference property and accessors

• Added useBuiltInList BooleanProperty field
• Updated constructor to accept useBuiltInList parameter
• Added getter method shouldUseBuiltInList()
• Added property accessor useBuiltInListProperty()
• Added setter method setUseBuiltInList()

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java


5. jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java ⚙️ Configuration changes +6/-1

Wire built-in list preference into preferences system

• Added USE_BUILT_IN_JOURNAL_LIST preference key constant
• Set default value to true in defaults map
• Updated getJournalAbbreviationPreferences() to pass preference value
• Added EasyBind listener to persist preference changes

jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java


6. jabgui/src/main/resources/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.fxml ✨ Enhancement +4/-0

Add checkbox UI element to preferences layout

• Added new HBox containing useBuiltInList CheckBox
• Positioned above existing FJournal checkbox
• Uses localized text property reference

jabgui/src/main/resources/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.fxml


7. jablib/src/main/resources/l10n/JabRef_en.properties 📝 Documentation +1/-0

Add localization for built-in list checkbox

• Added English localization string for new checkbox label

jablib/src/main/resources/l10n/JabRef_en.properties


8. CHANGELOG.md 📝 Documentation +1/-0

Document new journal list preference feature

• Added entry describing new feature to disable built-in journal list
• Linked to related issue #12468

CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects Bot commented Mar 22, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (6) 📎 Requirement gaps (0)

Grey Divider


Action required

1. JournalAbbreviationPreferences boolean constructor params 📘 Rule violation ⚙ Maintainability
Description
The public constructor JournalAbbreviationPreferences(List, boolean, boolean) introduces
boolean-flag parameters that create ambiguous call sites and reduce API clarity. This violates the
guideline to avoid boolean parameters in public methods.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[R16-22]

 public JournalAbbreviationPreferences(List<String> externalJournalLists,
-                                          boolean useFJournalField) {
+                                          boolean useFJournalField,
+                                          boolean useBuiltInList) {
     this.externalJournalLists = FXCollections.observableArrayList(externalJournalLists);
     this.useFJournalField = new SimpleBooleanProperty(useFJournalField);
+        this.useBuiltInList = new SimpleBooleanProperty(useBuiltInList);
 }
Evidence
PR Compliance ID 10 disallows boolean-flag parameters in public methods; the changed public
constructor now takes boolean useFJournalField and boolean useBuiltInList, which is exactly the
flagged pattern.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A public constructor introduces boolean flags (`useFJournalField`, `useBuiltInList`), creating unclear/ambiguous call sites.
## Issue Context
Compliance requires avoiding boolean parameters in public methods.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Missing toggle behavior tests 📘 Rule violation ≡ Correctness
Description
Core logic in org.jabref.logic was changed to support disabling the built-in journal list, but no
corresponding tests were added/updated in this PR to cover the new preference-controlled behavior.
This increases regression risk for repository loading and preference persistence.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R35-59]

 public static JournalAbbreviationRepository loadRepository(JournalAbbreviationPreferences journalAbbreviationPreferences) {
     JournalAbbreviationRepository repository;
-        // Initialize with built-in list
-        try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
-            if (resourceAsStream == null) {
-                LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
-                repository = new JournalAbbreviationRepository();
-            } else {
-                Path tempDir = Files.createTempDirectory("jabref-journal");
-                Path tempJournalList = tempDir.resolve("journal-list.mv");
-                Files.copy(resourceAsStream, tempJournalList);
-                repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
-                tempDir.toFile().deleteOnExit();
-                tempJournalList.toFile().deleteOnExit();
-                LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
+                    tempJournalList.toFile().deleteOnExit();
+                    LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+                }
+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
         }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
     }
Evidence
PR Compliance IDs 17 and 18 require updating/adding tests for behavior changes, especially for
changes under org.jabref.logic; this PR changes the loader logic to skip the built-in list based
on shouldUseBuiltInList(), but includes no test changes covering this new branch.

AGENTS.md
AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds a new preference-controlled branch to disable loading the bundled `journal-list.mv`, but lacks test coverage.
## Issue Context
This is a behavior change in `org.jabref.logic` and should be covered by unit tests (e.g., repository is empty when the built-in list is disabled, and non-empty when enabled; preference persistence via `JabRefCliPreferences` if applicable).
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Disabled list not empty🐞 Bug ≡ Correctness
Description
When the user disables the built-in journal list, JournalAbbreviationLoader still initializes
JournalAbbreviationRepository() which seeds a hard-coded “Demonstration/Demo” abbreviation, so the
repository is not empty and users cannot rely solely on custom lists.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-41]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
Evidence
In the new preference-off branch, the loader uses the no-arg JournalAbbreviationRepository
constructor. That constructor is documented/implemented as a demo fallback and explicitly inserts a
“Demonstration” abbreviation, meaning disabling built-in does not yield an empty repository.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-60]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `shouldUseBuiltInList()` is false, `JournalAbbreviationLoader.loadRepository` constructs `new JournalAbbreviationRepository()`, which seeds a demo abbreviation entry. This violates the feature promise of “no built-in list”.
### Issue Context
`JournalAbbreviationRepository()` is explicitly a demo fallback constructor.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-76]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
### Recommended fix
- Introduce a new constructor/factory for an actually-empty repository (no demo entry), e.g. `JournalAbbreviationRepository.empty(LtwaRepository ltwa)` or a new constructor `JournalAbbreviationRepository(LtwaRepository ltwa)`.
- In the `!shouldUseBuiltInList()` branch, use that empty constructor/factory instead of the demo fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (9)
4. LTWA repository skipped🐞 Bug ≡ Correctness
Description
Disabling the built-in list also disables LTWA-based abbreviation because loadLtwaRepository() is
only loaded in the built-in branch; the disabled branch uses the empty LtwaRepository from the demo
constructor.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-51]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
Evidence
The loader only calls loadLtwaRepository() when the built-in MVStore is loaded. The preference-off
branch constructs JournalAbbreviationRepository() which sets `ltwaRepository = new
LtwaRepository()` (empty). Downstream, LTWA mode uses
journalAbbreviationRepository.getLtwaAbbreviation(...), which will no longer abbreviate without
the LTWA MV store loaded.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java[59-61]
jablib/src/main/java/org/jabref/logic/journals/ltwa/LtwaRepository.java[35-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new preference intended to disable the *built-in journal abbreviation list* also disables LTWA abbreviations as a side effect.
### Issue Context
LTWA is loaded via `loadLtwaRepository()` only in the built-in-list branch. The disabled branch constructs a repository with an empty `LtwaRepository`.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[32-71]
### Recommended fix
- Ensure `LtwaRepository` is loaded regardless of `useBuiltInList`, unless you explicitly want this preference to disable LTWA too.
- This likely requires adding an “empty but LTWA-enabled” repository constructor/factory and using it in the disabled branch.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. UI ignores built-in toggle 🐞 Bug ≡ Correctness
Description
JournalAbbreviationsTabViewModel.setValues always calls addBuiltInList(), so the Preferences UI will
still show a “JabRef built in list” pseudo-file even when “Use JabRef built-in journal abbreviation
list” is unchecked.
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R111-114]

+        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
     createFileObjects();
     selectLastJournalFile();
     addBuiltInList();
Evidence
setValues() unconditionally calls addBuiltInList(). addBuiltInList() always reads
journalAbbreviationRepository.getAllLoaded() and appends a built-in pseudo file to journalFiles,
without checking useBuiltInList. Since the preference checkbox is bound to
useBuiltInListProperty(), the UI state can claim built-in is disabled while still listing (and
allowing selecting) the built-in list item.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
jabgui/src/main/java/org/jabref/gui/preferences/journals/AbbreviationsFileViewModel.java[38-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Preferences UI always adds a built-in list entry regardless of the new `useBuiltInList` checkbox.
### Issue Context
`setValues()` calls `addBuiltInList()` unconditionally, and `addBuiltInList()` unconditionally appends a pseudo built-in file.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
### Recommended fix
- In `setValues()`, call `addBuiltInList()` only if `useBuiltInList.get()` is true.
- Also consider removing an existing built-in pseudo file from `journalFiles` when the user unchecks the box (so the list updates within the dialog, not only after restart).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. useFJournal not loaded🐞 Bug ≡ Correctness
Description
JournalAbbreviationsTabViewModel never initializes useFJournal from JournalAbbreviationPreferences
in setValues(), so opening Preferences and saving can overwrite the persisted useFJournal setting
with the default value (true).
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R311-315]

                 abbreviationsPreferences.setExternalJournalLists(journalStringList);
                 abbreviationsPreferences.setUseFJournalField(useFJournal.get());
+                    abbreviationsPreferences.setUseBuiltInList(useBuiltInList.get());
Evidence
The ViewModel’s useFJournal property defaults to true and is bound to the UI checkbox, but unlike
the new useBuiltInList, it is never set from abbreviationsPreferences in setValues().
storeSettings() writes abbreviationsPreferences.setUseFJournalField(useFJournal.get()), so the
stored preference can be silently reset to true when the user saves preferences.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[49-51]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[300-325]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[33-43]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `useFJournal` checkbox is not initialized from stored preferences, which can cause saving preferences to overwrite the persisted value.
### Issue Context
`useBuiltInList` is initialized in `setValues()`, but `useFJournal` is not.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
### Recommended fix
- Add `useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());` in `setValues()` alongside the new `useBuiltInList` initialization.
- Add/adjust a unit test to cover that the checkbox reflects persisted preferences and that saving does not reset it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. JournalAbbreviationPreferences boolean constructor params 📘 Rule violation ⚙ Maintainability
Description
The public constructor JournalAbbreviationPreferences(List, boolean, boolean) introduces
boolean-flag parameters that create ambiguous call sites and reduce API clarity. This violates the
guideline to avoid boolean parameters in public methods.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[R16-22]

public JournalAbbreviationPreferences(List<String> externalJournalLists,
-                                          boolean useFJournalField) {
+                                          boolean useFJournalField,
+                                          boolean useBuiltInList) {
    this.externalJournalLists = FXCollections.observableArrayList(externalJournalLists);
    this.useFJournalField = new SimpleBooleanProperty(useFJournalField);
+        this.useBuiltInList = new SimpleBooleanProperty(useBuiltInList);
}
Evidence
PR Compliance ID 10 disallows boolean-flag parameters in public methods; the changed public
constructor now takes boolean useFJournalField and boolean useBuiltInList, which is exactly the
flagged pattern.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A public constructor introduces boolean flags (`useFJournalField`, `useBuiltInList`), creating unclear/ambiguous call sites.
## Issue Context
Compliance requires avoiding boolean parameters in public methods.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Missing toggle behavior tests 📘 Rule violation ≡ Correctness
Description
Core logic in org.jabref.logic was changed to support disabling the built-in journal list, but no
corresponding tests were added/updated in this PR to cover the new preference-controlled behavior.
This increases regression risk for repository loading and preference persistence.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R35-59]

public static JournalAbbreviationRepository loadRepository(JournalAbbreviationPreferences journalAbbreviationPreferences) {
    JournalAbbreviationRepository repository;
-        // Initialize with built-in list
-        try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
-            if (resourceAsStream == null) {
-                LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
-                repository = new JournalAbbreviationRepository();
-            } else {
-                Path tempDir = Files.createTempDirectory("jabref-journal");
-                Path tempJournalList = tempDir.resolve("journal-list.mv");
-                Files.copy(resourceAsStream, tempJournalList);
-                repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
-                tempDir.toFile().deleteOnExit();
-                tempJournalList.toFile().deleteOnExit();
-                LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
+                    tempJournalList.toFile().deleteOnExit();
+                    LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+                }
+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
        }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
    }
Evidence
PR Compliance IDs 17 and 18 require updating/adding tests for behavior changes, especially for
changes under org.jabref.logic; this PR changes the loader logic to skip the built-in list based
on shouldUseBuiltInList(), but includes no test changes covering this new branch.

AGENTS.md
AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds a new preference-controlled branch to disable loading the bundled `journal-list.mv`, but lacks test coverage.
## Issue Context
This is a behavior change in `org.jabref.logic` and should be covered by unit tests (e.g., repository is empty when the built-in list is disabled, and non-empty when enabled; preference persistence via `JabRefCliPreferences` if applicable).
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Disabled list not empty🐞 Bug ≡ Correctness
Description
When the user disables the built-in journal list, JournalAbbreviationLoader still initializes
JournalAbbreviationRepository() which seeds a hard-coded “Demonstration/Demo” abbreviation, so the
repository is not empty and users cannot rely solely on custom lists.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-41]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
Evidence
In the new preference-off branch, the loader uses the no-arg JournalAbbreviationRepository
constructor. That constructor is documented/implemented as a demo fallback and explicitly inserts a
“Demonstration” abbreviation, meaning disabling built-in does not yield an empty repository.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-60]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `shouldUseBuiltInList()` is false, `JournalAbbreviationLoader.loadRepository` constructs `new JournalAbbreviationRepository()`, which seeds a demo abbreviation entry. This violates the feature promise of “no built-in list”.
### Issue Context
`JournalAbbreviationRepository()` is explicitly a demo fallback constructor.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-76]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
### Recommended fix
- Introduce a new constructor/factory for an actually-empty repository (no demo entry), e.g. `JournalAbbreviationRepository.empty(LtwaRepository ltwa)` or a new constructor `JournalAbbreviationRepository(LtwaRepository ltwa)`.
- In the `!shouldUseBuiltInList()` branch, use that empty constructor/factory instead of the demo fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. LTWA repository skipped🐞 Bug ≡ Correctness
Description
Disabling the built-in list also disables LTWA-based abbreviation because loadLtwaRepository() is
only loaded in the built-in branch; the disabled branch uses the empty LtwaRepository from the demo
constructor.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-51]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
Evidence
The loader only calls loadLtwaRepository() when the built-in MVStore is loaded. The preference-off
branch constructs JournalAbbreviationRepository() which sets `ltwaRepository = new
LtwaRepository()` (empty). Downstream, LTWA mode uses
journalAbbreviationRepository.getLtwaAbbreviation(...), which will no longer abbreviate without
the LTWA MV store loaded.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java[59-61]
jablib/src/main/java/org/jabref/logic/journals/ltwa/LtwaRepository.java[35-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new preference intended to disable the *built-in journal abbreviation list* also disables LTWA abbreviations as a side effect.
### Issue Context
LTWA is loaded via `loadLtwaRepository()` only in the built-in-list branch. The disabled branch constructs a repository with an empty `LtwaRepository`.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[32-71]
### Recommended fix
- Ensure `LtwaRepository` is loaded regardless of `useBuiltInList`, unless you explicitly want this preference to disable LTWA too.
- This likely requires adding an “empty but LTWA-enabled” repository constructor/factory and using it in the disabled branch.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. UI ignores built-in toggle 🐞 Bug ≡ Correctness
Description
JournalAbbreviationsTabViewModel.setValues always calls addBuiltInList(), so the Preferences UI will
still show a “JabRef built in list” pseudo-file even when “Use JabRef built-in journal abbreviation
list” is unchecked.
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R111-114]

+        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
    createFileObjects();
    selectLastJournalFile();
    addBuiltInList();
Evidence
setValues() unconditionally calls addBuiltInList(). addBuiltInList() always reads
journalAbbreviationRepository.getAllLoaded() and appends a built-in pseudo file to journalFiles,
without checking useBuiltInList. Since the preference checkbox is bound to
useBuiltInListProperty(), the UI state can claim built-in is disabled while still listing (and
allowing selecting) the built-in list item.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
jabgui/src/main/java/org/jabref/gui/preferences/journals/AbbreviationsFileViewModel.java[38-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Preferences UI always adds a built-in list entry regardless of the new `useBuiltInList` checkbox.
### Issue Context
`setValues()` calls `addBuiltInList()` unconditionally, and `addBuiltInList()` unconditionally appends a pseudo built-in file.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
### Recommended fix
- In `setValues()`, call `addBuiltInList()` only if `useBuiltInList.get()` is true.
- Also consider removing an existing built-in pseudo file from `journalFiles` when the user unchecks the box (so the list updates within the dialog, not only after restart).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. useFJournal not loaded🐞 Bug ≡ Correctness
Description
JournalAbbreviationsTabViewModel never initializes useFJournal from JournalAbbreviationPreferences
in setValues(), so opening Preferences and saving can overwrite the persisted useFJournal setting
with the default value (true).
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R311-315]

                abbreviationsPreferences.setExternalJournalLists(journalStringList);
                abbreviationsPreferences.setUseFJournalField(useFJournal.get());
+                    abbreviationsPreferences.setUseBuiltInList(useBuiltInList.get());
Evidence
The ViewModel’s useFJournal property defaults to true and is bound to the UI checkbox, but unlike
the new useBuiltInList, it is never set from abbreviationsPreferences in setValues().
storeSettings() writes abbreviationsPreferences.setUseFJournalField(useFJournal.get()), so the
stored preference can be silently reset to true when the user saves preferences.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[49-51]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[300-325]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[33-43]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `useFJournal` checkbox is not initialized from stored preferences, which can cause saving preferences to overwrite the persisted value.
### Issue Context
`useBuiltInList` is initialized in `setValues()`, but `useFJournal` is not.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
### Recommended fix
- Add `useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());` in `setValues()` alongside the new `useBuiltInList` initialization.
- Add/adjust a unit test to cover that the checkbox reflects persisted preferences and that saving does not reset it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

13. loadRepository() returns null 📘 Rule violation ≡ Correctness
Description
On IOException, JournalAbbreviationLoader.loadRepository(...) returns null, which violates the
null-safety requirement and can lead to downstream NullPointerExceptions. Prefer returning a
non-null fallback (or changing the API to Optional) and handling the error explicitly.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R55-58]

+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
         }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
Evidence
PR Compliance ID 12 requires avoiding returning null from public APIs; the modified code path
explicitly does return null; when loading fails.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`JournalAbbreviationLoader.loadRepository(...)` returns `null` on `IOException`, violating null-safety expectations.
## Issue Context
Callers may not be null-safe, causing runtime NPEs. Compliance requires avoiding returning/passing null for new/changed public behavior.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. loadRepository() returns null 📘 Rule violation ≡ Correctness
Description
On IOException, JournalAbbreviationLoader.loadRepository(...) returns null, which violates the
null-safety requirement and can lead to downstream NullPointerExceptions. Prefer returning a
non-null fallback (or changing the API to Optional) and handling the error explicitly.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R55-58]

+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
        }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
Evidence
PR Compliance ID 12 requires avoiding returning null from public APIs; the modified code path
explicitly does return null; when loading fails.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`JournalAbbreviationLoader.loadRepository(...)` returns `null` on `IOException`, violating null-safety expectations.
## Issue Context
Callers may not be null-safe, causing runtime NPEs. Compliance requires avoiding returning/passing null for new/changed public behavior.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

15. Duplicate useFJournal set 🐞 Bug ⚙ Maintainability
Description
JournalAbbreviationsTabViewModel.setValues sets useFJournal twice, making state initialization
harder to reason about and easier to break during future edits. The duplicate assignment is
introduced by the PR adding an earlier set without removing the original one.
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R111-112]

+        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
+        useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());
Evidence
The method assigns useFJournal near the top of setValues and again at the end of the method body.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-118]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`setValues()` assigns `useFJournal` twice; the second assignment is redundant after the newly added initialization.
### Issue Context
This is a preference initialization method called when the tab is shown/refreshed.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-118]
### What to change
- Remove one of the duplicate `useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());` calls (keep exactly one, in the most appropriate place).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a user-facing preference toggle to disable JabRef’s bundled journal abbreviation list, allowing users to rely only on external/custom lists.

Changes:

  • Introduces a persisted useBuiltInList journal-abbreviation preference (default: enabled).
  • Wires the toggle into GUI preferences (FXML + tab + view model) and repository loading.
  • Documents the new preference in the changelog and adds an i18n string.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
jablib/src/main/resources/l10n/JabRef_en.properties Adds localized label for the new checkbox.
jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java Persists the new useBuiltInJournalList preference and binds it into JournalAbbreviationPreferences.
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java Extends preferences model with a useBuiltInList property.
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java Applies the preference when building the abbreviation repository.
jabgui/src/main/resources/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.fxml Adds the new checkbox to the preferences UI.
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java Stores/loads the new toggle and updates repository after saving preferences.
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java Binds the new checkbox to the view model property.
CHANGELOG.md Announces the new preference in the “Added” section.
Comments suppressed due to low confidence (1)

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java:115

  • setValues() always calls addBuiltInList(), even when the new useBuiltInList preference is false. This will still add a “JabRef built in list” entry in the UI (and currently shows whatever journalAbbreviationRepository.getAllLoaded() returns), which is confusing when the user explicitly disabled the built-in list.

Suggestion: only call addBuiltInList() (and show the built-in list entry) if useBuiltInList is enabled.

    public void setValues() {
        journalFiles.clear();

        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
        createFileObjects();
        selectLastJournalFile();
        addBuiltInList();
    }

LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
repository = new JournalAbbreviationRepository();
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

When the built-in list is disabled, this uses new JournalAbbreviationRepository(), but that constructor populates a hardcoded "Demonstration" abbreviation and an empty LtwaRepository. This means the repository is not actually empty (contradicting the PR description) and it also disables LTWA-based abbreviation mode.

Consider introducing an explicit “empty repository” constructor/factory (no demo data) and decide whether LTWA should still be loaded independently of the built-in journal list toggle.

Suggested change
repository = new JournalAbbreviationRepository();
try {
Path tempDir = Files.createTempDirectory("jabref-empty-journal");
Path tempJournalList = tempDir.resolve("journal-list.mv");
// Create an empty MV file to represent an empty built-in journal list
Files.createFile(tempJournalList);
repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
tempDir.toFile().deleteOnExit();
tempJournalList.toFile().deleteOnExit();
LOGGER.debug("Created empty journal abbreviation repository with LTWA support from {}", tempJournalList.toAbsolutePath());
} catch (IOException e) {
// Preserve previous behavior as a fallback if LTWA or temp files cannot be loaded/created
LOGGER.warn("Could not create empty journal abbreviation repository with LTWA; falling back to default repository.", e);
repository = new JournalAbbreviationRepository();
}

Copilot uses AI. Check for mistakes.
Comment on lines 35 to 59
public static JournalAbbreviationRepository loadRepository(JournalAbbreviationPreferences journalAbbreviationPreferences) {
JournalAbbreviationRepository repository;

// Initialize with built-in list
try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
if (resourceAsStream == null) {
LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
repository = new JournalAbbreviationRepository();
} else {
Path tempDir = Files.createTempDirectory("jabref-journal");
Path tempJournalList = tempDir.resolve("journal-list.mv");
Files.copy(resourceAsStream, tempJournalList);
repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
tempDir.toFile().deleteOnExit();
tempJournalList.toFile().deleteOnExit();
LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
repository = new JournalAbbreviationRepository();
} else {
try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
if (resourceAsStream == null) {
LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
repository = new JournalAbbreviationRepository();
} else {
Path tempDir = Files.createTempDirectory("jabref-journal");
Path tempJournalList = tempDir.resolve("journal-list.mv");
Files.copy(resourceAsStream, tempJournalList);
repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
tempDir.toFile().deleteOnExit();
tempJournalList.toFile().deleteOnExit();
LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
}
} catch (IOException e) {
LOGGER.error("Error while loading journal abbreviation repository", e);
return null;
}
} catch (IOException e) {
LOGGER.error("Error while loading journal abbreviation repository", e);
return null;
}
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

New behavior is introduced in loadRepository based on useBuiltInList, but there is no regression test verifying that (a) disabling the built-in list results in no built-in abbreviations being applied, and (b) external lists still load and override correctly. There are already unit tests covering built-in loading and LTWA behavior, so adding a focused test case here would help prevent future regressions.

Copilot uses AI. Check for mistakes.
Comment on lines 35 to 59
public static JournalAbbreviationRepository loadRepository(JournalAbbreviationPreferences journalAbbreviationPreferences) {
JournalAbbreviationRepository repository;

// Initialize with built-in list
try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
if (resourceAsStream == null) {
LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
repository = new JournalAbbreviationRepository();
} else {
Path tempDir = Files.createTempDirectory("jabref-journal");
Path tempJournalList = tempDir.resolve("journal-list.mv");
Files.copy(resourceAsStream, tempJournalList);
repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
tempDir.toFile().deleteOnExit();
tempJournalList.toFile().deleteOnExit();
LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
repository = new JournalAbbreviationRepository();
} else {
try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
if (resourceAsStream == null) {
LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
repository = new JournalAbbreviationRepository();
} else {
Path tempDir = Files.createTempDirectory("jabref-journal");
Path tempJournalList = tempDir.resolve("journal-list.mv");
Files.copy(resourceAsStream, tempJournalList);
repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
tempDir.toFile().deleteOnExit();
tempJournalList.toFile().deleteOnExit();
LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
}
} catch (IOException e) {
LOGGER.error("Error while loading journal abbreviation repository", e);
return null;
}
} catch (IOException e) {
LOGGER.error("Error while loading journal abbreviation repository", e);
return null;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. Missing toggle behavior tests 📘 Rule violation ✓ Correctness

Core logic in org.jabref.logic was changed to support disabling the built-in journal list, but no
corresponding tests were added/updated in this PR to cover the new preference-controlled behavior.
This increases regression risk for repository loading and preference persistence.
Agent Prompt
## Issue description
The PR adds a new preference-controlled branch to disable loading the bundled `journal-list.mv`, but lacks test coverage.

## Issue Context
This is a behavior change in `org.jabref.logic` and should be covered by unit tests (e.g., repository is empty when the built-in list is disabled, and non-empty when enabled; preference persistence via `JabRefCliPreferences` if applicable).

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +111 to 114
useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
createFileObjects();
selectLastJournalFile();
addBuiltInList();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

5. Ui ignores built-in toggle 🐞 Bug ✓ Correctness

JournalAbbreviationsTabViewModel.setValues always calls addBuiltInList(), so the Preferences UI will
still show a “JabRef built in list” pseudo-file even when “Use JabRef built-in journal abbreviation
list” is unchecked.
Agent Prompt
### Issue description
The Preferences UI always adds a built-in list entry regardless of the new `useBuiltInList` checkbox.

### Issue Context
`setValues()` calls `addBuiltInList()` unconditionally, and `addBuiltInList()` unconditionally appends a pseudo built-in file.

### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]

### Recommended fix
- In `setValues()`, call `addBuiltInList()` only if `useBuiltInList.get()` is true.
- Also consider removing an existing built-in pseudo file from `journalFiles` when the user unchecks the box (so the list updates within the dialog, not only after restart).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Mar 22, 2026
@testlens-app

This comment has been minimized.

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Mar 23, 2026

✅ All tests passed ✅

🏷️ Commit: 94e6f92
▶️ Tests: 10203 executed
⚪️ Checks: 50/50 completed


Learn more about TestLens at testlens.app.

@github-actions github-actions Bot added status: no-bot-comments status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete status: no-bot-comments labels Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@Siedlerchr
Copy link
Copy Markdown
Member

No progress for 2 weeks, closing

@Siedlerchr Siedlerchr closed this Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

This pull requests was closed without merging. You have been unassigned from the respective issue #12468. In case you closed the PR for yourself, you can re-open it. Please also check After submission of a pull request in CONTRIBUTING.md.

@AnvitaPrasad
Copy link
Copy Markdown
Contributor Author

@Siedlerchr, sorry for the delay! I’ve merged the latest upstream/main and resolved the conflicts. It’s up to date now. Could you please reopen the PR when you get a chance?

@Siedlerchr Siedlerchr reopened this Apr 10, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add toggle to disable built-in journal abbreviation list

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add checkbox to disable built-in journal abbreviation list
• Users can now rely exclusively on custom journal lists
• Preference persists across application restarts
• Empty repository created when built-in list disabled
Diagram
flowchart LR
  A["User Preference"] -->|useBuiltInList| B["JournalAbbreviationPreferences"]
  B -->|shouldUseBuiltInList| C["JournalAbbreviationLoader"]
  C -->|true| D["Load Built-in List"]
  C -->|false| E["Create Empty Repository"]
  D --> F["JournalAbbreviationRepository"]
  E --> F
  F -->|External Lists| G["Combined Abbreviations"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java ✨ Enhancement +2/-0

Add UI checkbox binding for built-in list toggle

• Added useBuiltInList CheckBox FXML field
• Bound checkbox to viewModel property bidirectionally

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.java


2. jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java ✨ Enhancement +8/-0

Add viewModel property for built-in list preference

• Added useBuiltInList SimpleBooleanProperty with default true
• Initialize property from preferences in setValues()
• Store preference value in storeSettings()
• Added getter method useBuiltInListProperty()

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java


3. jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java ✨ Enhancement +35/-16

Conditionally load built-in journal list based on preference

• Added import for MVStore from H2 database
• Refactored loadRepository() to check shouldUseBuiltInList() preference
• Create empty MV store when built-in list disabled
• Load built-in list only when preference enabled
• Updated loadBuiltInRepository() to pass new parameter

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java


View more (5)
4. jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java ✨ Enhancement +19/-2

Add useBuiltInList preference property and accessors

• Added useBuiltInList BooleanProperty field
• Updated constructor to accept useBuiltInList parameter
• Added getter shouldUseBuiltInList()
• Added property getter useBuiltInListProperty()
• Added setter setUseBuiltInList()
• Updated setAll() to sync the new property

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java


5. jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java ⚙️ Configuration changes +5/-1

Persist built-in list preference in backing store

• Added USE_BUILT_IN_JOURNAL_LIST constant for preference key
• Added listener binding for useBuiltInListProperty() to persist changes
• Updated getJournalAbbreviationPreferencesFromBackingStore() to read and pass preference

jablib/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java


6. CHANGELOG.md 📝 Documentation +1/-0

Document new journal list toggle feature

• Added entry documenting new feature to disable built-in journal list
• References issue #12468

CHANGELOG.md


7. jabgui/src/main/resources/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.fxml ✨ Enhancement +4/-0

Add UI checkbox for built-in list preference

• Added new HBox containing useBuiltInList CheckBox
• Positioned above existing FJournal checkbox
• Uses localized text property

jabgui/src/main/resources/org/jabref/gui/preferences/journals/JournalAbbreviationsTab.fxml


8. jablib/src/main/resources/l10n/JabRef_en.properties 📝 Documentation +1/-0

Add English localization for checkbox label

• Added English localization for new checkbox label
• Text: "Use JabRef built-in journal abbreviation list"

jablib/src/main/resources/l10n/JabRef_en.properties


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects Bot commented Apr 10, 2026

Code Review by Qodo

🐞 Bugs (2)   📘 Rule violations (3)   📎 Requirement gaps (0)   🎨 UX Issues (0)
🐞\ ≡ Correctness (1) ⚙ Maintainability (1) ⭐ New (1)
📘\ ≡ Correctness (2) ⚙ Maintainability (1)

Grey Divider


Action required

1. JournalAbbreviationPreferences boolean constructor params 📘
Description
The public constructor JournalAbbreviationPreferences(List, boolean, boolean) introduces
boolean-flag parameters that create ambiguous call sites and reduce API clarity. This violates the
guideline to avoid boolean parameters in public methods.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[R16-22]

 public JournalAbbreviationPreferences(List<String> externalJournalLists,
-                                          boolean useFJournalField) {
+                                          boolean useFJournalField,
+                                          boolean useBuiltInList) {
     this.externalJournalLists = FXCollections.observableArrayList(externalJournalLists);
     this.useFJournalField = new SimpleBooleanProperty(useFJournalField);
+        this.useBuiltInList = new SimpleBooleanProperty(useBuiltInList);
 }
Evidence
PR Compliance ID 10 disallows boolean-flag parameters in public methods; the changed public
constructor now takes boolean useFJournalField and boolean useBuiltInList, which is exactly the
flagged pattern.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A public constructor introduces boolean flags (`useFJournalField`, `useBuiltInList`), creating unclear/ambiguous call sites.
## Issue Context
Compliance requires avoiding boolean parameters in public methods.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[16-22]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Missing toggle behavior tests 📘
Description
Core logic in org.jabref.logic was changed to support disabling the built-in journal list, but no
corresponding tests were added/updated in this PR to cover the new preference-controlled behavior.
This increases regression risk for repository loading and preference persistence.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R35-59]

 public static JournalAbbreviationRepository loadRepository(JournalAbbreviationPreferences journalAbbreviationPreferences) {
     JournalAbbreviationRepository repository;
-        // Initialize with built-in list
-        try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
-            if (resourceAsStream == null) {
-                LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
-                repository = new JournalAbbreviationRepository();
-            } else {
-                Path tempDir = Files.createTempDirectory("jabref-journal");
-                Path tempJournalList = tempDir.resolve("journal-list.mv");
-                Files.copy(resourceAsStream, tempJournalList);
-                repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
-                tempDir.toFile().deleteOnExit();
-                tempJournalList.toFile().deleteOnExit();
-                LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
+                    tempJournalList.toFile().deleteOnExit();
+                    LOGGER.debug("Loaded journal abbreviations from {}", tempJournalList.toAbsolutePath());
+                }
+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
         }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
     }
Evidence
PR Compliance IDs 17 and 18 require updating/adding tests for behavior changes, especially for
changes under org.jabref.logic; this PR changes the loader logic to skip the built-in list based
on shouldUseBuiltInList(), but includes no test changes covering this new branch.

AGENTS.md
AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds a new preference-controlled branch to disable loading the bundled `journal-list.mv`, but lacks test coverage.
## Issue Context
This is a behavior change in `org.jabref.logic` and should be covered by unit tests (e.g., repository is empty when the built-in list is disabled, and non-empty when enabled; preference persistence via `JabRefCliPreferences` if applicable).
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Disabled list not empty🐞
Description
When the user disables the built-in journal list, JournalAbbreviationLoader still initializes
JournalAbbreviationRepository() which seeds a hard-coded “Demonstration/Demo” abbreviation, so the
repository is not empty and users cannot rely solely on custom lists.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-41]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
Evidence
In the new preference-off branch, the loader uses the no-arg JournalAbbreviationRepository
constructor. That constructor is documented/implemented as a demo fallback and explicitly inserts a
“Demonstration” abbreviation, meaning disabling built-in does not yield an empty repository.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-60]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `shouldUseBuiltInList()` is false, `JournalAbbreviationLoader.loadRepository` constructs `new JournalAbbreviationRepository()`, which seeds a demo abbreviation entry. This violates the feature promise of “no built-in list”.
### Issue Context
`JournalAbbreviationRepository()` is explicitly a demo fallback constructor.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-76]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
### Recommended fix
- Introduce a new constructor/factory for an actually-empty repository (no demo entry), e.g. `JournalAbbreviationRepository.empty(LtwaRepository ltwa)` or a new constructor `JournalAbbreviationRepository(LtwaRepository ltwa)`.
- In the `!shouldUseBuiltInList()` branch, use that empty constructor/factory instead of the demo fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (3)
4. LTWA repository skipped🐞
Description
Disabling the built-in list also disables LTWA-based abbreviation because loadLtwaRepository() is
only loaded in the built-in branch; the disabled branch uses the empty LtwaRepository from the demo
constructor.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R38-51]

+        if (!journalAbbreviationPreferences.shouldUseBuiltInList()) {
+            LOGGER.debug("Built-in journal abbreviation list is disabled by user preference.");
+            repository = new JournalAbbreviationRepository();
+        } else {
+            try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/journal-list.mv")) {
+                if (resourceAsStream == null) {
+                    LOGGER.warn("There is no journal-list.mv. We use a default journal list.");
+                    repository = new JournalAbbreviationRepository();
+                } else {
+                    Path tempDir = Files.createTempDirectory("jabref-journal");
+                    Path tempJournalList = tempDir.resolve("journal-list.mv");
+                    Files.copy(resourceAsStream, tempJournalList);
+                    repository = new JournalAbbreviationRepository(tempJournalList, loadLtwaRepository());
+                    tempDir.toFile().deleteOnExit();
Evidence
The loader only calls loadLtwaRepository() when the built-in MVStore is loaded. The preference-off
branch constructs JournalAbbreviationRepository() which sets `ltwaRepository = new
LtwaRepository()` (empty). Downstream, LTWA mode uses
journalAbbreviationRepository.getLtwaAbbreviation(...), which will no longer abbreviate without
the LTWA MV store loaded.

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[59-71]
jablib/src/main/java/org/jabref/logic/cleanup/AbbreviateJournalCleanup.java[59-61]
jablib/src/main/java/org/jabref/logic/journals/ltwa/LtwaRepository.java[35-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new preference intended to disable the *built-in journal abbreviation list* also disables LTWA abbreviations as a side effect.
### Issue Context
LTWA is loaded via `loadLtwaRepository()` only in the built-in-list branch. The disabled branch constructs a repository with an empty `LtwaRepository`.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[35-59]
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java[32-71]
### Recommended fix
- Ensure `LtwaRepository` is loaded regardless of `useBuiltInList`, unless you explicitly want this preference to disable LTWA too.
- This likely requires adding an “empty but LTWA-enabled” repository constructor/factory and using it in the disabled branch.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. UI ignores built-in toggle 🐞
Description
JournalAbbreviationsTabViewModel.setValues always calls addBuiltInList(), so the Preferences UI will
still show a “JabRef built in list” pseudo-file even when “Use JabRef built-in journal abbreviation
list” is unchecked.
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R111-114]

+        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
     createFileObjects();
     selectLastJournalFile();
     addBuiltInList();
Evidence
setValues() unconditionally calls addBuiltInList(). addBuiltInList() always reads
journalAbbreviationRepository.getAllLoaded() and appends a built-in pseudo file to journalFiles,
without checking useBuiltInList. Since the preference checkbox is bound to
useBuiltInListProperty(), the UI state can claim built-in is disabled while still listing (and
allowing selecting) the built-in list item.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
jabgui/src/main/java/org/jabref/gui/preferences/journals/AbbreviationsFileViewModel.java[38-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Preferences UI always adds a built-in list entry regardless of the new `useBuiltInList` checkbox.
### Issue Context
`setValues()` calls `addBuiltInList()` unconditionally, and `addBuiltInList()` unconditionally appends a pseudo built-in file.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-147]
### Recommended fix
- In `setValues()`, call `addBuiltInList()` only if `useBuiltInList.get()` is true.
- Also consider removing an existing built-in pseudo file from `journalFiles` when the user unchecks the box (so the list updates within the dialog, not only after restart).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. useFJournal not loaded🐞
Description
JournalAbbreviationsTabViewModel never initializes useFJournal from JournalAbbreviationPreferences
in setValues(), so opening Preferences and saving can overwrite the persisted useFJournal setting
with the default value (true).
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R311-315]

                 abbreviationsPreferences.setExternalJournalLists(journalStringList);
                 abbreviationsPreferences.setUseFJournalField(useFJournal.get());
+                    abbreviationsPreferences.setUseBuiltInList(useBuiltInList.get());
Evidence
The ViewModel’s useFJournal property defaults to true and is bound to the UI checkbox, but unlike
the new useBuiltInList, it is never set from abbreviationsPreferences in setValues().
storeSettings() writes abbreviationsPreferences.setUseFJournalField(useFJournal.get()), so the
stored preference can be silently reset to true when the user saves preferences.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[49-51]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[300-325]
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationPreferences.java[33-43]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `useFJournal` checkbox is not initialized from stored preferences, which can cause saving preferences to overwrite the persisted value.
### Issue Context
`useBuiltInList` is initialized in `setValues()`, but `useFJournal` is not.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-115]
### Recommended fix
- Add `useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());` in `setValues()` alongside the new `useBuiltInList` initialization.
- Add/adjust a unit test to cover that the checkbox reflects persisted preferences and that saving does not reset it.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

7. loadRepository() returns null 📘
Description
On IOException, JournalAbbreviationLoader.loadRepository(...) returns null, which violates the
null-safety requirement and can lead to downstream NullPointerExceptions. Prefer returning a
non-null fallback (or changing the API to Optional) and handling the error explicitly.
Code

jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[R55-58]

+            } catch (IOException e) {
+                LOGGER.error("Error while loading journal abbreviation repository", e);
+                return null;
         }
-        } catch (IOException e) {
-            LOGGER.error("Error while loading journal abbreviation repository", e);
-            return null;
Evidence
PR Compliance ID 12 requires avoiding returning null from public APIs; the modified code path
explicitly does return null; when loading fails.

AGENTS.md
jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`JournalAbbreviationLoader.loadRepository(...)` returns `null` on `IOException`, violating null-safety expectations.
## Issue Context
Callers may not be null-safe, causing runtime NPEs. Compliance requires avoiding returning/passing null for new/changed public behavior.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/journals/JournalAbbreviationLoader.java[55-58]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

8. Duplicate useFJournal set 🐞
Description
JournalAbbreviationsTabViewModel.setValues sets useFJournal twice, making state initialization
harder to reason about and easier to break during future edits. The duplicate assignment is
introduced by the PR adding an earlier set without removing the original one.
Code

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[R111-112]

+        useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
+        useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());
Evidence
The method assigns useFJournal near the top of setValues and again at the end of the method body.

jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-118]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`setValues()` assigns `useFJournal` twice; the second assignment is redundant after the newly added initialization.

### Issue Context
This is a preference initialization method called when the tab is shown/refreshed.

### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/journals/JournalAbbreviationsTabViewModel.java[107-118]

### What to change
- Remove one of the duplicate `useFJournal.set(abbreviationsPreferences.shouldUseFJournalField());` calls (keep exactly one, in the most appropriate place).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@github-actions github-actions Bot added status: no-bot-comments status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete status: no-bot-comments labels Apr 10, 2026
Copy link
Copy Markdown
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

Looks good to me

Comment on lines +45 to +49
try (MVStore store = new MVStore.Builder()
.fileName(emptyJournalList.toAbsolutePath().toString()).open()) {
store.openMap("FullToAbbreviation");
}
repository = new JournalAbbreviationRepository(emptyJournalList, loadLtwaRepository());
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.

Would want a second look on this by @koppor

@github-actions github-actions Bot added status: no-bot-comments status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete status: no-bot-comments labels Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to disable the built-in JabRef journal abbreviation list

4 participants