Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OO] Javadoc & readibility improvements #12216

Merged
merged 9 commits into from
Dec 17, 2024
Merged

Conversation

subhramit
Copy link
Member

@subhramit subhramit commented Nov 21, 2024

Recently I learnt about @implSpec tags which are used to specify requirements/preconditions for methods.
This helped clean the documentation of my code a bit.

The tag shows up as "Implementation Requirements:" in javadoc as follows:

Screenshot (5)

Additional:

  • Fixed module export for gradle task javadoc
  • Fixed some miscellaneous typos
  • Changed some variable names for better readability

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@subhramit subhramit changed the title [OO] Improve documentation [OO] Javadoc: Add @implSpec tags Nov 21, 2024
@subhramit
Copy link
Member Author

subhramit commented Nov 21, 2024

Thought: Like we have priority classifications for issues, should we have labels for PRs as well such as "non-blocking", "non-breaking", "non-urgent", "low priority", etc.?

@calixtus
Copy link
Member

Some reading about this tag: https://nipafx.dev/javadoc-tags-apiNote-implSpec-implNote/

koppor
koppor previously requested changes Nov 29, 2024
Comment on lines 508 to 505
* <b>Precondition 3:</b> Run this test ONLY on numeric Citation Styles.</p>
*
* @implSpec 1. Assumes that {@link CitationStyleGenerator#generateBibliography(List, String, CitationStyleOutputFormat, BibDatabaseContext, BibEntryTypesManager) generateBibliography} works as expected.<br>
* 2. Assumes that the method {@link CSLFormatUtils#transformHTML(String) transformHTML} works as expected.<br>
* 3. Run this test ONLY on numeric Citation Styles.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe convert to Markdown (/// instead of *) to have that rendered proply (Otherwise, you should use <ol> and <li>.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@subhramit
Copy link
Member Author

subhramit commented Dec 3, 2024

@koppor I tried to generate the javadoc using the gradle task, but it failed due to the following two errors (something related to module export):

D:\git-repositories\JabRef\src\main\java\org\jabref\gui\search\GlobalSearchBar.java:68: error: package impl.org.controlsfx.skin is not visible
import impl.org.controlsfx.skin.AutoCompletePopup;
                          ^
  (package impl.org.controlsfx.skin is declared in module org.controlsfx.controls, which does not export it to module org.jabref)
D:\git-repositories\JabRef\src\main\java\org\jabref\gui\util\CustomRatingSkin.java:7: error: package impl.org.controlsfx.skin is not visible
import impl.org.controlsfx.skin.RatingSkin;
                          ^
  (package impl.org.controlsfx.skin is declared in module org.controlsfx.controls, which does not export it to module org.jabref)

cc: @calixtus

@calixtus
Copy link
Member

calixtus commented Dec 4, 2024

You need to modify module-info.java, but don't ask me how, it's always try and error with me, I did not yet deep dive into java module system.

@Siedlerchr
Copy link
Member

Siedlerchr commented Dec 4, 2024

You need to add the add-export calls for the javadoc task

jabref/build.gradle

Lines 596 to 598 in 0dad3e1

addMultilineStringsOption("-add-exports").setValue([
'javafx.controls/com.sun.javafx.scene.control=org.jabref'
])

This was from an old issue java9-modularity/gradle-modules-plugin#170

@subhramit subhramit marked this pull request as draft December 9, 2024 22:02
@subhramit subhramit requested a review from koppor December 17, 2024 11:02
@subhramit subhramit marked this pull request as ready for review December 17, 2024 11:02
@subhramit
Copy link
Member Author

@Siedlerchr ready for merge

@subhramit subhramit changed the title [OO] Javadoc: Add @implSpec tags [OO] Javadoc improvements Dec 17, 2024
@subhramit subhramit changed the title [OO] Javadoc improvements [OO] Javadoc & readibility improvements Dec 17, 2024
@subhramit subhramit added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 17, 2024
@Siedlerchr Siedlerchr enabled auto-merge December 17, 2024 14:14
@subhramit subhramit removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 17, 2024
@Siedlerchr Siedlerchr added this pull request to the merge queue Dec 17, 2024
Merged via the queue into JabRef:main with commit 006bbd0 Dec 17, 2024
27 of 28 checks passed
@Siedlerchr Siedlerchr deleted the javadoc branch December 17, 2024 14:31
ar-rana pushed a commit to ar-rana/jabref that referenced this pull request Dec 26, 2024
* Add `@implSpec` tags, clean docs

* Fix variable name, link

* Fix more javadoc

* Add `controlsfx.skin` module export

* Fix rendering list of requirements

* Rename variables (bibliography)

* Fix method name in comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants