Collection Reflexivity Violation
JabRef version
Latest development branch build (please note build date below)
Operating system
Windows
Details on version and operating system
Windows 11 Home 25H2 26200.8457, Jabref forked and built on 22/05/2026
Checked with the latest development build (copy version output from About dialog)
- [x] I made a backup of my libraries before testing the latest development version.
- [x] I have tested the latest development version and the problem persists
Steps to reproduce the behaviour
- Add the below JabRefBug1.java file to base "jabref" folder
// Bug 1: getFieldValues() violates equals() reflexivity
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.types.StandardEntryType;
import java.util.Collection;
public class JabRefBug1 {
public static void main(String[] args) {
BibEntry entry = new BibEntry(StandardEntryType.Article);
Collection<String> values = entry.getFieldValues();
// This should ALWAYS print true in Java, but it evaluates to false
System.out.println("Is collection equal to itself? " + values.equals(values));
}
}
- Compile it using below command:
javac -cp "jablib\build\classes\java\main;jablib\build\dependencies\*" JabRefBug1.java - Run it using below command:
C:\git-repositories\jabref>java -cp ".;jablib\build\classes\java\main;jablib\build\dependencies\*" JabRefBug1
Current output: Is collection equal to itself? false
Appendix
Found this bug using automated contract testing with Randoop and tested using above Minimal Reproducible Example (MRE). When we call bibEntry.getFieldValues(), it returns a Collection
I don't see the practicality of this issue
I don't see the practicality of this issue
true, maybe its just a best practices suggestion.
Do you have any ideas why this might happen, sushovit29?
Mh, as JabRef is not just a hobby project, but also claims to be used for teaching SE i think this issue is still valid, even though the parcticallity is not obvious. Nevertheless, not high priority, but valid imho.
Clean data structures is also our aim. We spend dozens of hours to work on tnis 2015 to maybe 2018. Now its time for a new ara of students to take over. Will take maybe 1 year to fix the whole data model throughout the code, but yeah, go ahead! Please remember test-driven development with all functionality of JabRef (imports, exports, GUI, CLI, Browser Plugin, Word Plugin, HTTP Server, ...). Nice challenge!
/assign-me
Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.
At this point in time, you raised 1 pull request(s) of which 100% (1/1) have been merged.
⏰ Assignment Reminder
Hi @MateusLyoshka, this is a friendly reminder about your assignment to this issue.
[!WARNING] This issue will be automatically unassigned in 7 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 7 days
- Asking for the 📌 Pinned label if you need more time
We appreciate your contribution and are here to help if needed!
It is important to keep memory and performance in mind as this is a critical section in the code and consumers just merely iterate over the collection.
We saw that this causes much effort when working on it - https://github.com/JabRef/jabref/pull/15986#issuecomment-4750182642
Since no user of JabLib made this request @sushovit29, we closed it.