Skip to content

Clean up unused code in BibEntry class#14377

Merged
koppor merged 1 commit intoJabRef:mainfrom
Jennnyyy:fix-assignment
Nov 21, 2025
Merged

Clean up unused code in BibEntry class#14377
koppor merged 1 commit intoJabRef:mainfrom
Jennnyyy:fix-assignment

Conversation

@Jennnyyy
Copy link
Copy Markdown
Contributor

@Jennnyyy Jennnyyy commented Nov 20, 2025

While reviewing BibEntry, I noticed that two overloads of withSharedBibEntryData existed:

public BibEntry withSharedBibEntryData(int sharedId, int version) {
    sharedBibEntryData.setSharedID(sharedId);
    sharedBibEntryData.setVersion(version);
    return this;
}

public BibEntry withSharedBibEntryData(SharedBibEntryData sharedBibEntryData) {
    sharedBibEntryData = sharedBibEntryData;
    return this;
}

The second method contained a self-assignment bug (sharedBibEntryData = sharedBibEntryData;) and therefore did not update the field. After searching the codebase, I found that this method is not used anywhere.

What this PR does
Removes the unused and incorrect withSharedBibEntryData(SharedBibEntryData) method.
The reason to remove: Unused code increases complexity and makes future refactoring harder. Removing this also improves maintainability.

Steps to test

Mandatory checks

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

Copy link
Copy Markdown
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Maybe used at #11879, but I can re-add if needed.

@koppor koppor added the dev: code-quality Issues related to code or architecture decisions label Nov 21, 2025
@koppor koppor enabled auto-merge November 21, 2025 20:32
@koppor koppor added this pull request to the merge queue Nov 21, 2025
Merged via the queue into JabRef:main with commit ef47145 Nov 21, 2025
89 of 96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev: code-quality Issues related to code or architecture decisions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants