Skip to content

Fix garbled BibEntry Javadoc example#15834

Merged
Siedlerchr merged 1 commit into
mainfrom
fix-comment
May 26, 2026
Merged

Fix garbled BibEntry Javadoc example#15834
Siedlerchr merged 1 commit into
mainfrom
fix-comment

Conversation

@koppor

@koppor koppor commented May 26, 2026

Copy link
Copy Markdown
Member

PR Description

The class-level Javadoc on BibEntry showed a single garbled example line (Some commment={fieldValue},otherFieldName ={otherFieldValue}). The original multi-line BibTeX block was collapsed when the Javadoc was converted from HTML to Markdown (commit fb5a3e7), leaving the surrounding bullets referencing misc, key, fieldName, and otherFieldName without anything in the example to match. This PR restores the multi-line BibTeX example inside a fenced ```bibtex code block so the example matches the explanatory text below it.

Steps to test

  1. Open jablib/src/main/java/org/jabref/model/entry/BibEntry.java in an IDE.
  2. Hover the class name or open the Javadoc preview.
  3. Confirm the example renders as a multi-line BibTeX code block and matches the bulleted explanation underneath.

AI usage

Claude Code (model claude-opus-4-7)

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code
  • [/] 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 added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • [/] I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

Restore the multi-line BibTeX example that was collapsed into a
single nonsensical line when the Javadoc was converted from HTML to
Markdown.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Restore multi-line BibTeX example in BibEntry Javadoc

📝 Documentation

Grey Divider

Walkthroughs

Description
• Restores multi-line BibTeX example in BibEntry class Javadoc
• Replaces garbled single-line example with properly formatted code block
• Aligns example with explanatory bullet points below it
Diagram
flowchart LR
  A["Garbled single-line<br/>Javadoc example"] -->|"Convert to<br/>fenced code block"| B["Multi-line BibTeX<br/>example with @misc entry"]
  B -->|"Matches explanatory<br/>bullets"| C["Clear documentation<br/>for developers"]

Loading

Grey Divider

File Changes

1. jablib/src/main/java/org/jabref/model/entry/BibEntry.java 📝 Documentation +7/-1

Fix garbled BibEntry Javadoc example formatting

• Replaced garbled single-line example with properly formatted multi-line BibTeX code block
• Added fenced code block with bibtex language identifier for syntax highlighting
• Restored complete @misc entry structure with key, fieldName, and otherFieldName fields
• Example now matches the explanatory bullet points that follow it

jablib/src/main/java/org/jabref/model/entry/BibEntry.java


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0)

Grey Divider


Remediation recommended

1. Misleading BibTeX comment line 🐞 Bug ⚙ Maintainability
Description
The BibEntry class example is fenced as bibtex but starts with a bare Some comment line, which
isn’t shown using BibTeX comment syntax and can mislead readers into copying invalid .bib content.
This is reinforced by the implementation: “user comments” are arbitrary pre-entry text and are
written back verbatim, so the example should either use proper BibTeX comment notation or clarify
it’s arbitrary text.
Code

jablib/src/main/java/org/jabref/model/entry/BibEntry.java[R71-73]

Evidence
The Javadoc example currently places Some comment inside a bibtex fenced block, while the
model/writer treat pre-entry comments as arbitrary text and emit it verbatim—so the example should
avoid presenting a non-comment-prefixed line as canonical BibTeX.

jablib/src/main/java/org/jabref/model/entry/BibEntry.java[67-85]
jablib/src/main/java/org/jabref/model/entry/BibEntry.java[956-967]
jablib/src/main/java/org/jabref/logic/bibtex/BibEntryWriter.java[69-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`BibEntry`’s documentation example is labeled as BibTeX (```bibtex) but includes a plain `Some comment` line, which is ambiguous as BibTeX and may be copy/pasted as-is.

### Issue Context
Internally, `getUserComments()` is documented as “arbitrary text before the entry” and `BibEntryWriter` writes that text verbatim, so the Javadoc example should avoid implying that raw text is a canonical BibTeX comment.

### Fix Focus Areas
- jablib/src/main/java/org/jabref/model/entry/BibEntry.java[67-86]

### Suggested fix
Update the example to show a *valid* BibTeX comment line, e.g.:
- Change `Some comment` to `% Some comment` (or `@comment{Some comment}`), and update the explanatory bullet accordingly (e.g., “`% Some comment` is the comment before the entry”).

Alternative: keep the raw line but change the fence label / wording to explicitly say it’s “arbitrary text before the entry” (not standard BibTeX comment syntax).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread jablib/src/main/java/org/jabref/model/entry/BibEntry.java
@Siedlerchr Siedlerchr added this pull request to the merge queue May 26, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label May 26, 2026
Merged via the queue into main with commit 8ac5c4b May 26, 2026
77 checks passed
@Siedlerchr Siedlerchr deleted the fix-comment branch May 26, 2026 21:01
Siedlerchr added a commit to InAnYan/jabref that referenced this pull request May 28, 2026
* upstream/main: (29 commits)
  Chore(deps): Bump dev.langchain4j:langchain4j-bom in /versions (JabRef#15853)
  Chore(deps): Bump org.glassfish.jaxb:jaxb-runtime in /versions (JabRef#15854)
  Chore(deps): Bump com.gradleup.shadow:shadow-gradle-plugin (JabRef#15852)
  Chore(deps): Bump com.gradleup.shadow:shadow-gradle-plugin (JabRef#15849)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (JabRef#15850)
  Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.6 (JabRef#15844)
  Fix reset and import of AiPreferences (JabRef#15843)
  Fix Comparable Contract Violation in SharedBibEntryData (JabRef#15806) (JabRef#15842)
  Chore(deps): Bump com.dlsc.gemsfx:gemsfx from 4.0.5 to 4.1.0 in /versions (JabRef#15841)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (JabRef#15840)
  New Crowdin updates (JabRef#15839)
  Add group pseudonymization support (fixes JabRef#14117) (JabRef#15258)
  Feature parse MeSH terms in PubMed MEDLINE records (JabRef#15529)
  Fix/non latin author parsed as name prefix (JabRef#15823)
  Fix not on fx thread cleanup (JabRef#15835)
  Fix garbled BibEntry Javadoc example (JabRef#15834)
  Revert "Fix cleanup operationn setFiles not on fx thread causes exceptiosn"
  Revert "changelog"
  changelog
  Fix cleanup operationn setFiles not on fx thread causes exceptiosn
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants