jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Improve BibEntry

Open espertusnu opened this issue 2 months ago β€’ 11 comments

Is your suggestion for improvement related to a problem? Please describe.

There are places where BibEntry could be improved:

  1. The semantics of the withX() methods are unclear. Specifically
    • Should it be called immediately after construction and before use?
    • Should it return this or a new instance?
  2. There are methods that return mutable fields but do not create defensive copies.
  3. There is code that is uncalled, including from tests. I spotted a bug in one of these methods.
  4. getSourceField() could be rewritten in a (slightly) more data-driven manner, with, for example, lists of forbidden fields rather than multi-way disjunctions.
  5. @NotNull keyword could be added.

Describe the solution you'd like

I would like clarifications on the desired semantics and for this issue to be assigned to me and my students.

Additional context

I am an instructor looking for an exercise for my students.

@koppor said on Gitter:

We have BibEntry#withField and more "withers". However, they modify the Object at hand - and thus contradict the expection of a "wither" to create a copy. All of these could be rewritten to be a proper builder.

espertusnu avatar Oct 11 '25 20:10 espertusnu

Hi! I'm Ayush (MCA 2026). I'd like to work on this issue (#14067) as my first contribution. Could you please assign it to me?

AyusHkaushaL1 avatar Nov 05 '25 06:11 AyusHkaushaL1

πŸ‘‹ Hey @AyusHkaushaL1, looks like you’re eager to work on this issue β€” great! πŸŽ‰ It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.

github-actions[bot] avatar Nov 05 '25 06:11 github-actions[bot]

/assign-me

AyusHkaushaL1 avatar Nov 05 '25 06:11 AyusHkaushaL1

πŸ‘‹ Hey @AyusHkaushaL1, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

github-actions[bot] avatar Nov 05 '25 06:11 github-actions[bot]

⏰ Assignment Reminder

Hi @AyusHkaushaL1, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 11 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 11 days
  • Asking for the πŸ“Œ Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Nov 14 '25 12:11 github-actions[bot]

One could also experiment with https://github.com/skinny85/jilt

There, one needs to import static and compile time only dependency.

koppor avatar Nov 15 '25 08:11 koppor

πŸ“‹ Assignment Update

Hi @AyusHkaushaL1, due to inactivity, you have been unassigned from this issue.

Next steps


If you still want to work on this:

  • Submit a pull request showing your current state. You will be automatically assigned again.
  • Ask a maintainer to assign you again.

github-actions[bot] avatar Nov 25 '25 12:11 github-actions[bot]

i have gone through the codebase, and understood the issue. I guess i can contribute. Plz assign me

k-singh171 avatar Dec 11 '25 10:12 k-singh171

/assign-me

k-singh171 avatar Dec 11 '25 10:12 k-singh171

πŸ‘‹ Hey @k-singh171, looks like you’re eager to work on this issue β€” great! πŸŽ‰ It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.

jabref-machine avatar Dec 11 '25 10:12 jabref-machine

πŸ‘‹ Hey @k-singh171, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

jabref-machine avatar Dec 11 '25 10:12 jabref-machine

I would like clarifications on the desired semantics and for this issue to be assigned to me and my students.

I totally overlooked that. - Maybe I was hoping that some persons with some software engineering skills would come up with a clarification.

I think, this needs experimentation.

First experiment:

Replace als with... by a builder generated by jilt. Reason: Current "withers" are builders. See class comment note.

  • If it looks good: We go ahead
  • If it looks bad: We do something else

Note: If ".with" is needed to form a new bbientry, .toBuilder can be used.

koppor avatar Dec 12 '25 19:12 koppor