Skip to content

Conversation

@shubhamk0205
Copy link
Contributor

Closes #14143

This PR removes the SmartGroup class and replaces it with ExplicitGroup, as both provided the same functionality. It also resolves an architectural violation by moving the group factory methods from the GUI layer (JabRefSuggestedGroups) into the logic layer (GroupsFactory). Additionally, DefaultGroupsFactory has been renamed to GroupsFactory for improved clarity and naming consistency.

To preserve compatibility, migration logic has been added to ensure that existing .bib files containing serialized SmartGroup entries continue to load correctly and are transparently converted to ExplicitGroup.

Steps to test

  1. Test group creation and functionality

    • Open JabRef and create a new library.
    • Right-click on the All entries group → Add JabRef suggested groups.
    • Verify that:
      • Entries without linked files
      • Entries without groups
        are created successfully.
    • Ensure both groups filter entries as expected.
  2. Test backward compatibility

    • Open a .bib file containing SmartGroup entries (if available).
    • Verify that the groups load correctly and appear in the group tree.
    • Confirm that SmartGroup entries are automatically migrated to ExplicitGroup.
  3. Test “Imported Entries” group

    • Enable Preferences → Library → Add imported entries to group.
    • Import entries using web search, PDF import, or fetchers.
    • Check that imported entries appear in the Imported Entries group.
    • Confirm the group is an ExplicitGroup.
  4. Test general group operations

    • Create, edit, and delete groups.
    • Drag and drop groups in the groups tree.
    • Ensure all group operations behave normally without regressions.

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 the change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if the change is visible to the user)
  • [/] I checked the user documentation: If documentation needs updates, I opened an issue or submitted a PR to https://github.com/JabRef/user-documentation/

@github-actions
Copy link
Contributor

Hey @shubhamk0205!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️

We have automated checks in place, based on which you will soon get feedback if any of them are failing. In a while, maintainers will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

}

@Test
void serializeSmartGroup() {
Copy link
Member

@Siedlerchr Siedlerchr Nov 24, 2025

Choose a reason for hiding this comment

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

Please also add a test for the migration of the SmartGroup to the new Explicit groups and ideally roundtrip test.
Reading in old format -> Conversion -> Storing in new format

Copy link
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

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

add tests for parsing and roundtrip

@Siedlerchr Siedlerchr added the status: changes-required Pull requests that are not yet complete label Nov 24, 2025
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 25, 2025
@shubhamk0205
Copy link
Contributor Author

Done with the tests @Siedlerchr

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 26, 2025
Siedlerchr
Siedlerchr previously approved these changes Nov 30, 2025
Siedlerchr and others added 10 commits November 30, 2025 20:05
…into fix-for-issue-14143

* 'fix-for-issue-14143' of github.com:shubhamk0205/jabref:
  Undo changes to KeyCollisionException
…fork/shubhamk0205/fix-for-issue-14143

# Conflicts:
#	jablib/src/main/java/org/jabref/logic/importer/util/GroupsParser.java
…into fix-for-issue-14143

* 'fix-for-issue-14143' of github.com:shubhamk0205/jabref:
  Fix name
  Use _
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
koppor
koppor previously approved these changes Nov 30, 2025
@calixtus calixtus enabled auto-merge November 30, 2025 20:35
@calixtus calixtus disabled auto-merge November 30, 2025 20:36
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Nov 30, 2025
@koppor koppor enabled auto-merge November 30, 2025 20:44
@koppor koppor added this pull request to the merge queue Nov 30, 2025
Merged via the queue into JabRef:main with commit c178c1e Nov 30, 2025
48 checks passed
Siedlerchr added a commit to EricW123/jabref that referenced this pull request Dec 1, 2025
…ue676

* upstream/main: (227 commits)
  Adapt welcome message (JabRef#14487)
  Add message when closing a PR
  Add collection of "all" AI features (JabRef#14438)
  Trigger conflict-detection on push on main (JabRef#14479)
  Add unassigned_comment on comment issue
  New Crowdin updates (JabRef#14483)
  Tweak labels also at merge conflicts
  Merge --remove-label and --add-label
  Remove SmartGroup and refactor groups factory (JabRef#14398)
  more debug
  Support html when parsing arXiv identifiers (JabRef#14474)
  Add debug and fix run
  Remove "ready-for-review" if changes are required
  Have label move as last step of comment
  Add pr number to output
  change files to file(s) (JabRef#14465)
  Add CDS archive (JabRef#14476)
  Fix adapting labels (JabRef#14477)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (JabRef#14468)
  Chore(deps): Bump net.bytebuddy:byte-buddy in /versions (JabRef#14472)
  ...
Siedlerchr added a commit to tejjgv/jabref that referenced this pull request Dec 2, 2025
* upstream/main: (102 commits)
  Adapt welcome message (JabRef#14487)
  Add message when closing a PR
  Add collection of "all" AI features (JabRef#14438)
  Trigger conflict-detection on push on main (JabRef#14479)
  Add unassigned_comment on comment issue
  New Crowdin updates (JabRef#14483)
  Tweak labels also at merge conflicts
  Merge --remove-label and --add-label
  Remove SmartGroup and refactor groups factory (JabRef#14398)
  more debug
  Support html when parsing arXiv identifiers (JabRef#14474)
  Add debug and fix run
  Remove "ready-for-review" if changes are required
  Have label move as last step of comment
  Add pr number to output
  change files to file(s) (JabRef#14465)
  Add CDS archive (JabRef#14476)
  Fix adapting labels (JabRef#14477)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (JabRef#14468)
  Chore(deps): Bump net.bytebuddy:byte-buddy in /versions (JabRef#14472)
  ...
shubhamk0205 added a commit to shubhamk0205/jabref that referenced this pull request Dec 3, 2025
* Remove SmartGroup and refactor groups factory

* Removed obsolete SmartGroup localization key &  Fixed KeyCollision

* Fix the code so the @nonnull field id in KeyCollisionException.java is initialized in every constructor.

* added a test for the migraiton of the SmartGroup to the new Explicit groups and added tests for parsing and roundtrip

* Remove SmartGroup and refactor groups factory

# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java

* Removed obsolete SmartGroup localization key &  Fixed KeyCollision

* Fix the code so the @nonnull field id in KeyCollisionException.java is initialized in every constructor.

* added a test for the migration of the SmartGroup to the new Explicit groups and ideally roundtrip test.

* fixed format errors

* fixed format

* fixed importing issue

* fixed openwrite by commenting out in rewrite.yml

* runned rewriteRun gradel

* restoring rewrite.yml

* Remove duplicate test

* refine comments

* Undo changes to KeyCollisionException

* usse separator

* Fix variable names

* Use _

* Fix name

* Reduce scope of migration constant and remove superfluous throws

* add hint

* Fix format

* Add `@deprecated`

* Fix tests

---------

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
shubhamk0205 added a commit to shubhamk0205/jabref that referenced this pull request Dec 3, 2025
* Remove SmartGroup and refactor groups factory

* Removed obsolete SmartGroup localization key &  Fixed KeyCollision

* Fix the code so the @nonnull field id in KeyCollisionException.java is initialized in every constructor.

* added a test for the migraiton of the SmartGroup to the new Explicit groups and added tests for parsing and roundtrip

* Remove SmartGroup and refactor groups factory

# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java

* Removed obsolete SmartGroup localization key &  Fixed KeyCollision

* Fix the code so the @nonnull field id in KeyCollisionException.java is initialized in every constructor.

* added a test for the migration of the SmartGroup to the new Explicit groups and ideally roundtrip test.

* fixed format errors

* fixed format

* fixed importing issue

* fixed openwrite by commenting out in rewrite.yml

* runned rewriteRun gradel

* restoring rewrite.yml

* Remove duplicate test

* refine comments

* Undo changes to KeyCollisionException

* usse separator

* Fix variable names

* Use _

* Fix name

* Reduce scope of migration constant and remove superfluous throws

* add hint

* Fix format

* Add `@deprecated`

* Fix tests

---------

Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/collab/groupchange/GroupChange.java
#	jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java
#	jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java
#	jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
#	jabgui/src/main/java/org/jabref/migrations/ConvertMarkingToGroups.java
#	jabgui/src/test/java/org/jabref/migrations/ConvertMarkingToGroupsTest.java
#	jablib/src/main/java/org/jabref/logic/bibtex/comparator/MetaDataDiff.java
#	jablib/src/main/java/org/jabref/logic/groups/GroupsFactory.java
#	jablib/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java
#	jablib/src/main/java/org/jabref/logic/importer/util/GroupsParser.java
#	jablib/src/main/java/org/jabref/logic/util/MetadataSerializationConfiguration.java
#	jablib/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java
#	jablib/src/test/java/org/jabref/logic/exporter/GroupSerializerTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contrib status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite "Imported Entries" feature

4 participants