Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Added

- We added an option in Journal Abbreviations preferences to disable the built-in JabRef journal abbreviation list, allowing users to rely solely on their own custom lists. [#12468](https://github.com/JabRef/jabref/issues/12468)
- We added `--key-patterns` option to CLI parameters to allows users to set a citation key's pattern for a specific entry type. [#14707](https://github.com/JabRef/jabref/issues/14707)
- We added a CLI option `--field-formatters` to the `convert` and `generate-bib-from-aux` commands to apply field formatters during export. [#11520](https://github.com/JabRef/jabref/issues/11520)
- We added a preference to skip the import dialog for entries received from browser extensions, allowing direct import into the current library. The import dialog is shown by default; users can enable direct import in Preferences.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class JournalAbbreviationsTab extends AbstractPreferenceTabView<JournalAb

@FXML private CustomTextField searchBox;
@FXML private CheckBox useFJournal;
@FXML private CheckBox useBuiltInList;

@Inject private TaskExecutor taskExecutor;
@Inject private JournalAbbreviationRepository abbreviationRepository;
Expand Down Expand Up @@ -133,6 +134,7 @@ private void setBindings() {
filteredAbbreviations.setPredicate(abbreviation -> searchTerm.isEmpty() || abbreviation.containsCaseIndependent(searchTerm)));

useFJournal.selectedProperty().bindBidirectional(viewModel.useFJournalProperty());
useBuiltInList.selectedProperty().bindBidirectional(viewModel.useBuiltInListProperty());
}

private void setAnimations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class JournalAbbreviationsTabViewModel implements PreferenceTabViewModel
private final SimpleBooleanProperty isEditableAndRemovable = new SimpleBooleanProperty(false);
private final SimpleBooleanProperty isAbbreviationEditableAndRemovable = new SimpleBooleanProperty(false);
private final SimpleBooleanProperty useFJournal = new SimpleBooleanProperty(true);
private final SimpleBooleanProperty useBuiltInList = new SimpleBooleanProperty(true);

private final DialogService dialogService;
private final TaskExecutor taskExecutor;
Expand Down Expand Up @@ -107,6 +108,7 @@ public JournalAbbreviationsTabViewModel(JournalAbbreviationPreferences abbreviat
public void setValues() {
journalFiles.clear();

useBuiltInList.set(abbreviationsPreferences.shouldUseBuiltInList());
Comment thread
calixtus marked this conversation as resolved.
createFileObjects();
selectLastJournalFile();
addBuiltInList();
Comment on lines +111 to 115
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

Expand Down Expand Up @@ -309,6 +311,7 @@ public void storeSettings() {

abbreviationsPreferences.setExternalJournalLists(journalStringList);
abbreviationsPreferences.setUseFJournalField(useFJournal.get());
abbreviationsPreferences.setUseBuiltInList(useBuiltInList.get());

Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
if (shouldWriteLists) {
saveJournalAbbreviationFiles();
Expand Down Expand Up @@ -361,4 +364,8 @@ public SimpleBooleanProperty isFileRemovableProperty() {
public SimpleBooleanProperty useFJournalProperty() {
return useFJournal;
}

public SimpleBooleanProperty useBuiltInListProperty() {
return useBuiltInList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
</Button>
</HBox>

<HBox alignment="CENTER_LEFT" spacing="10.0">
<CheckBox fx:id="useBuiltInList" text="%Use JabRef built-in journal abbreviation list"/>
</HBox>

Comment on lines +85 to +88
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.

the two consecutive single child ,
consider grouping both checkboxes in a single for ex: , since they are both behavior toggles for journal abbreviations, but this is optional

<HBox alignment="CENTER_LEFT" spacing="10.0">
<CheckBox fx:id="useFJournal" text="%Use the field FJournal to store the full journal name for (un)abbreviations in the entry"/>
</HBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,27 @@ public static Collection<Abbreviation> readAbbreviationsFromCsvFile(Path file) t
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()) {
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.

Creating an empty MVStore on disk just to get a Path for the constructor is heavyweight (temp dir, MVStore write, two deleteOnExit, new import)

The no arg new JournalAbbreviationRepository() is NOT a clean substitute either, it inserts a fake "Demonstration" entry and drops LTWA support.

i suggested fix by adding a constructor that takes only LtwaRepository (what do you think?)

then removes the MVStore import, temp-file dance, and the extra return null path.

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.
} else {
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
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();
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
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;
}
Comment on lines 36 to 74
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 36 to 74
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


// Read external lists
Expand Down Expand Up @@ -90,6 +94,6 @@ private static LtwaRepository loadLtwaRepository() throws IOException {
}

public static JournalAbbreviationRepository loadBuiltInRepository() {
return loadRepository(new JournalAbbreviationPreferences(List.of(), true));
return loadRepository(new JournalAbbreviationPreferences(List.of(), true, true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ public class JournalAbbreviationPreferences {

private final ObservableList<String> externalJournalLists;
private final BooleanProperty useFJournalField;
private final BooleanProperty useBuiltInList;

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);
}
Comment thread
InAnYan marked this conversation as resolved.

public ObservableList<String> getExternalJournalLists() {
Expand All @@ -38,4 +41,16 @@ public BooleanProperty useFJournalFieldProperty() {
public void setUseFJournalField(boolean useFJournalField) {
this.useFJournalField.set(useFJournalField);
}

public boolean shouldUseBuiltInList() {
return useBuiltInList.get();
}

public BooleanProperty useBuiltInListProperty() {
return useBuiltInList;
}

public void setUseBuiltInList(boolean useBuiltInList) {
this.useBuiltInList.set(useBuiltInList);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ public class JabRefCliPreferences implements CliPreferences {
// Journal
private static final String EXTERNAL_JOURNAL_LISTS = "externalJournalLists";
private static final String USE_AMS_FJOURNAL = "useAMSFJournal";
private static final String USE_BUILT_IN_JOURNAL_LIST = "useBuiltInJournalList";

// Protected terms
private static final String PROTECTED_TERMS_ENABLED_EXTERNAL = "protectedTermsEnabledExternal";
Expand Down Expand Up @@ -649,6 +650,7 @@ public JabRefCliPreferences() {

defaults.put(EXTERNAL_JOURNAL_LISTS, "");
defaults.put(USE_AMS_FJOURNAL, true);
defaults.put(USE_BUILT_IN_JOURNAL_LIST, true);
defaults.put(LAST_USED_EXPORT, "");

defaults.put(STORE_RELATIVE_TO_BIB, Boolean.TRUE);
Expand Down Expand Up @@ -1163,12 +1165,15 @@ public JournalAbbreviationPreferences getJournalAbbreviationPreferences() {

journalAbbreviationPreferences = new JournalAbbreviationPreferences(
getStringList(EXTERNAL_JOURNAL_LISTS),
getBoolean(USE_AMS_FJOURNAL));
getBoolean(USE_AMS_FJOURNAL),
getBoolean(USE_BUILT_IN_JOURNAL_LIST));

journalAbbreviationPreferences.getExternalJournalLists().addListener((InvalidationListener) _ ->
putStringList(EXTERNAL_JOURNAL_LISTS, journalAbbreviationPreferences.getExternalJournalLists()));
EasyBind.listen(journalAbbreviationPreferences.useFJournalFieldProperty(),
(_, _, newValue) -> putBoolean(USE_AMS_FJOURNAL, newValue));
EasyBind.listen(journalAbbreviationPreferences.useBuiltInListProperty(),
(_, _, newValue) -> putBoolean(USE_BUILT_IN_JOURNAL_LIST, newValue));

return journalAbbreviationPreferences;
}
Expand Down
1 change: 1 addition & 0 deletions jablib/src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2814,6 +2814,7 @@ A\ backup\ file\ for\ '%0'\ was\ found\ at\ [%1]=A backup file for '%0' was foun
Do\ you\ want\ to\ recover\ the\ library\ from\ the\ backup\ file?=Do you want to recover the library from the backup file?
This\ could\ indicate\ that\ JabRef\ did\ not\ shut\ down\ cleanly\ last\ time\ the\ file\ was\ used.=This could indicate that JabRef did not shut down cleanly last time the file was used.

Use\ JabRef\ built-in\ journal\ abbreviation\ list=Use JabRef built-in journal abbreviation list
Use\ the\ field\ FJournal\ to\ store\ the\ full\ journal\ name\ for\ (un)abbreviations\ in\ the\ entry=Use the field FJournal to store the full journal name for (un)abbreviations in the entry

Library\ to\ import\ into=Library to import into
Expand Down
Loading