Skip to content

Fix duplicate entry types causing wrong fields after tab switch (#14985)#15052

Merged
Siedlerchr merged 2 commits into
JabRef:mainfrom
shubhamk0205:fix-for-issue-14985
Feb 10, 2026
Merged

Fix duplicate entry types causing wrong fields after tab switch (#14985)#15052
Siedlerchr merged 2 commits into
JabRef:mainfrom
shubhamk0205:fix-for-issue-14985

Conversation

@shubhamk0205

@shubhamk0205 shubhamk0205 commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Closes #14984
Closes #14985

Three entry types Legal, Jurisdiction, and Legislation were defined in both BiblatexNonStandardEntryType and BiblatexApaEntryType with different field definitions. When switching tabs in the entry editor, JabRef would re-resolve the type name and pick up the wrong definition (APA vs non-standard), causing required fields to change unexpectedly. This PR removes the duplicates from the non-standard enum, keeping only the APA versions which have the correct specialized fields, and moves all APA types into the "Non-standard types" UI section so they remain accessible.

Steps to test

  1. Open JabRef and create a new BibLaTeX library (File > New Library, then Library > Library properties > set mode to BibLaTeX)
  2. Open the New Entry dialog
  3. Scroll down or collapse Other types you should see a Non-standard types section containing 17 types (12 non-standard + 5 APA types like Legal, Jurisdiction, Legislation, Constitution, Legadminmaterial)
  4. Select Legal to create an entry
  5. In the entry editor, check the Required fields tab it should show APA-specific fields (Title, Date, URI, Keywords, Part, Section)
  6. Switch to another tab (e.g., General) and switch back to Required fields
  7. Verify the fields stay the same they should not change after switching tabs
  8. Repeat for Jurisdiction and Legislation to be thorough
  9. Right-click any entry > Change entry type confirm Legal/Jurisdiction/Legislation appear only once, inside the Non-standard types submenu

Mandatory checks

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix duplicate entry types causing wrong fields after tab switch

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Remove duplicate Legal, Jurisdiction, Legislation entries from non-standard enum
• Move APA entry types to non-standard UI section for consistency
• Fix field resolution to prevent wrong fields after tab switching
• Add APA-specific entry type descriptions and handling
Diagram
flowchart LR
  A["BiblatexNonStandardEntryType<br/>enum"] -->|remove duplicates| B["12 non-standard types<br/>Legal/Jurisdiction/Legislation removed"]
  C["BiblatexAPAEntryType<br/>enum"] -->|combine with| D["Non-standard types<br/>submenu in UI"]
  B -->|unified| D
  D -->|prevents| E["Correct field resolution<br/>on tab switch"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java ✨ Enhancement +12/-6

Combine APA types with non-standard submenu

• Import BiblatexAPAEntryTypeDefinitions for APA types
• Combine non-standard and APA types into single list for submenu
• Exclude both non-standard and APA types from main menu to avoid duplicates
• Update submenu creation to include both type definitions

jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java


2. jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java ✨ Enhancement +22/-7

Separate APA types and add descriptions

• Import BiblatexApaEntryType for type checking
• Remove APA types from general otherEntries list initialization
• Add APA types separately to non-standard pane
• Add descriptionOfApaEntryType() method for APA-specific descriptions
• Move Legal, Jurisdiction, Legislation descriptions to APA method
• Add descriptions for Constitution and Legadminmaterial APA types

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java


3. jablib/src/main/java/org/jabref/model/entry/types/BiblatexNonStandardEntryType.java 🐞 Bug fix +0/-3

Remove duplicate APA entry types

• Remove Jurisdiction, Legislation, and Legal enum values
• Keep 10 remaining non-standard entry types

jablib/src/main/java/org/jabref/model/entry/types/BiblatexNonStandardEntryType.java


View more (4)
4. jablib/src/main/java/org/jabref/model/entry/types/BiblatexNonStandardEntryTypeDefinitions.java 🐞 Bug fix +1/-9

Remove duplicate type definitions

• Remove static definitions for Jurisdiction, Legislation, Legal
• Remove imports for duplicate types
• Update ALL list from Arrays.asList to List.of with 12 types
• Remove unused Arrays import

jablib/src/main/java/org/jabref/model/entry/types/BiblatexNonStandardEntryTypeDefinitions.java


5. jablib/src/test/java/org/jabref/model/entry/types/BiblatexNonStandardEntryTypeDefinitionsTest.java 🧪 Tests +3/-4

Update tests for reduced type count

• Update test to expect 12 types instead of 15
• Remove Jurisdiction, Legislation, Legal from expected types set
• Update test method name to reflect new count

jablib/src/test/java/org/jabref/model/entry/types/BiblatexNonStandardEntryTypeDefinitionsTest.java


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

Document bug fix in changelog

• Add entry documenting fix for issue #14985
• Describe resolution of wrong required fields after tab switching

CHANGELOG.md


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

Add APA type descriptions localization

• Add localization for "Legislative and administrative material..." description
• Add localization for "National and international constitutions." description

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


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Missing locale keys 🐞 Bug ✧ Quality
Description
• Two new strings were introduced for APA entry type descriptions, but they were added only to
  JabRef_en.properties and are missing from other locale bundles.
• For users running a non-English locale, Localization.lookup will warn for each missing key and
  fall back to the English key text, causing log noise and untranslated tooltips when opening the New
  Entry dialog.
Code

jablib/src/main/resources/l10n/JabRef_en.properties[R2436-2437]

+Legislative\ and\ administrative\ material\ such\ as\ hearings,\ reports,\ and\ documents.=Legislative and administrative material such as hearings, reports, and documents.
+National\ and\ international\ constitutions.=National and international constitutions.
Evidence
The PR introduces two new localization keys in the English bundle, but the same section in other
locale bundles (e.g., DE/FR) does not include them. When these strings are requested via
Localization.lang, missing keys trigger a warning log and fall back to the key text.

jablib/src/main/resources/l10n/JabRef_en.properties[2434-2438]
jablib/src/main/resources/l10n/JabRef_de.properties[2409-2415]
jablib/src/main/resources/l10n/JabRef_fr.properties[2433-2438]
jablib/src/main/java/org/jabref/logic/l10n/Localization.java[130-136]

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

## Issue description
Two new localization keys were introduced for APA entry type descriptions, but they exist only in `JabRef_en.properties`. In non-English locales, these keys will be missing, causing warning logs and English fallback text.

## Issue Context
`Localization.lookup` logs a warning whenever a key is missing in the current locale bundle, and then falls back to the key text.

## Fix Focus Areas
- jablib/src/main/resources/l10n/JabRef_en.properties[2436-2437]
- jablib/src/main/java/org/jabref/logic/l10n/Localization.java[130-136]
- jablib/src/main/resources/l10n/JabRef_de.properties[2409-2414]
- jablib/src/main/resources/l10n/JabRef_fr.properties[2433-2437]

ⓘ 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

@testlens-app

testlens-app Bot commented Feb 8, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: f5deb3b
▶️ Tests: 9885 executed
🟡 Checks: 57/65 completed


Learn more about TestLens at testlens.app.

@shubhamk0205

Copy link
Copy Markdown
Contributor Author
  1. Missing locale keys 🐞 Bug ✧ Quality

Description

• Two new strings were introduced for APA entry type descriptions, but they were added only to
JabRef_en.properties and are missing from other locale bundles.
• For users running a non-English locale, Localization.lookup will warn for each missing key and
fall back to the English key text, causing log noise and untranslated tooltips when opening the New

this was intentional as i think jabref uses crowdin to deal with translations

@Siedlerchr Siedlerchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 9, 2026
@ThiloteE

ThiloteE commented Feb 9, 2026

Copy link
Copy Markdown
Member

Tried this PR and looks relatively good so far. The issues in the entry editor are gone and the saving works fine. Issue solved.

Unfortunately I found a new issue: #15074. So we need testing, if custom entry types with similar names as those non-standard entrytypes will be overwritten when upgrading from 5.15 to 6.0 and if so, we should discuss, if we need some kind of migration in place or prevent that from happening. Probably something for a dev-call. How to create a custom entry type is documented at https://docs.jabref.org/setup/customentrytypes.

I also found an issue that I documented at #11589 (comment), but that's not something you have to fix in this PR.

Comment thread CHANGELOG.md Outdated
Siedlerchr
Siedlerchr previously approved these changes Feb 10, 2026

@Siedlerchr Siedlerchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove entry from changelog

@Siedlerchr Siedlerchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue mentioned by Thilo is not related to this PR

@Siedlerchr Siedlerchr enabled auto-merge February 10, 2026 18:07
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Feb 10, 2026
@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 10, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 10, 2026
@ThiloteE

Copy link
Copy Markdown
Member

The issue mentioned by Thilo is not related to this PR

Is it though? Imagine a user having a custom entry type "video" with custom field "length" as required field in JabRef 5.15. Now they update to 6.0 and their custom entry type "video" might be overwritten with the non-standard entry type "video" that does NOT have "length" as required field. Which one wins? Need to test.

Merged via the queue into JabRef:main with commit e010c4d Feb 10, 2026
73 of 76 checks passed
@JabRef JabRef deleted a comment from jabref-machine Feb 10, 2026
@Siedlerchr

Copy link
Copy Markdown
Member

The point of this PR was to revert the overlapping of the APA and non standard types. Not about custom entry types in general.

@koppor

koppor commented Feb 11, 2026

Copy link
Copy Markdown
Member

their custom entry type "video" might be overwritten with the non-standard entry type "video" that does NOT have "length" as required field. Which one wins? Need to test.

"video" is now a StandardType (in the wording of JabRef), isn't it?

Customization of these types was introduced 2016 at #2331.

Interesting: The question of standard types was asked mid-2017 at #2331 (comment) - and left un-answered. --> Issue JabRef#248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: changes-required Pull requests that are not yet complete status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

4 participants