Revert "Added reading and writing with JSON for save actions metadata" - #16556
Conversation
PR Summary by QodoRevert JSON-based save actions metadata in .bib read/write path
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Arrays.asList used in test
|
| FieldFormatterCleanupActions saveActions = new FieldFormatterCleanupActions(true, | ||
| List.of( | ||
| Arrays.asList( | ||
| new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()), |
There was a problem hiding this comment.
1. arrays.aslist used in test 📘 Rule violation ⚙ Maintainability
The changed test uses Arrays.asList(...) instead of the modern immutable List.of(...), regressing Java 25+ idioms and readability. This increases mutability risk and inconsistency with project conventions.
Agent Prompt
## Issue description
The test now uses `Arrays.asList(...)` where modern JabRef style prefers `List.of(...)`.
## Issue Context
The compliance checklist requires using modern Java idioms (Java 25+), including `List.of` over legacy list factories.
## Fix Focus Areas
- jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java[782-786]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| assertEquals("@Comment{jabref-meta: saveActions:enabled;" | ||
| + OS.NEWLINE | ||
| + "title[lower_case]" + OS.NEWLINE | ||
| + "journal[title_case]" + OS.NEWLINE |
There was a problem hiding this comment.
2. Multiline string built via + 📘 Rule violation ⚙ Maintainability
The changed assertion builds a multi-line expected value via string concatenation instead of a text block, reducing readability and maintainability. This conflicts with the modern Java idioms requirement.
Agent Prompt
## Issue description
A multi-line expected string is constructed using chained `+` concatenation with `OS.NEWLINE` instead of using a Java text block.
## Issue Context
The compliance checklist calls out text blocks as the preferred modern Java construct for multi-line constants.
## Fix Focus Areas
- jablib/src/test/java/org/jabref/logic/exporter/BibDatabaseWriterTest.java[792-798]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| /// Tests for reading whole bib files can be found at {@link org.jabref.logic.importer.fileformat.BibtexImporterTest} | ||
| /// | ||
| /// Tests cannot be executed concurrently, because Localization is used at [BibtexParser#parseAndAddEntry(String)] | ||
| /// Tests cannot be executed concurrently, because Localization is used at {@link BibtexParser#parseAndAddEntry(String)} |
There was a problem hiding this comment.
3. {@link} used in /// 📘 Rule violation ⚙ Maintainability
A changed Markdown Javadoc (///) comment uses a Javadoc inline tag {@link ...} instead of
Markdown-style linking. This violates the documentation style requirement and reduces consistency.
Agent Prompt
## Issue description
The updated `///` documentation comment uses a Javadoc inline tag (`{@link ...}`) rather than Markdown Javadoc style.
## Issue Context
Project policy requires Markdown Javadoc (`///`) to use Markdown conventions and avoid Javadoc inline tags.
## Fix Focus Areas
- jablib/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java[80-83]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| } catch (ParseException ex) { | ||
| parserResult.addException(new ParserResult.Range(startLine, startColumn, line, column), ex); | ||
| } | ||
| } else if (comment.startsWith(MetaData.META_FLAG_V1)) { |
There was a problem hiding this comment.
4. Stale json metadata persisted 🐞 Bug ≡ Correctness
After the revert, BibtexParser no longer recognizes jabref-meta-0.1.0 JSON metadata comments, so they are kept as ordinary pre-entry text/epilog and will be written back unchanged. Since BibDatabaseWriter no longer rewrites JSON metadata, these legacy JSON blocks can become stale and conflict with the canonical jabref-meta: metadata after subsequent saves.
Agent Prompt
### Issue description
The parser no longer treats `@Comment{jabref-meta-0.1.0 ...}` as JabRef-managed metadata, so these blocks are preserved as regular comments/epilog and will round-trip unchanged. Because the writer no longer generates/updates these JSON blocks, they can become stale and contradict the actual metadata JabRef writes.
### Issue Context
This PR is a revert of JSON save-actions metadata support. However, files produced while that support existed may still contain `jabref-meta-0.1.0` JSON metadata comments.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java[358-409]
- jablib/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java[321-340]
### Suggested change
In `parseJabRefComment`, add a legacy/cleanup branch that detects JSON metadata comments (e.g., prefix `jabref-meta-0.1.0`) and calls `dumpTextReadSoFarToString()` (optionally also add a warning) so these comments are not preserved in `commentsBeforeEntry`/epilog when rewriting files.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Reverts #15159
Due to internal discussion - change in priorities for v6.0, will continue for v7.0 or next year in the form of a GSoC project.