Skip to content

Conversation

@Zeglow
Copy link
Owner

@Zeglow Zeglow commented Oct 22, 2025

Closes JabRef#14066

Steps to test

  1. Check out this branch and build the project using ./gradlew build
  2. Ensure the build completes successfully without errors

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 change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user 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 updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@espertusnu
Copy link
Collaborator

I think CitationKeyGeneratorTest.java might have been included by mistake.

Copy link
Collaborator

@espertusnu espertusnu left a comment

Choose a reason for hiding this comment

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

Very nice work! Comments are just FYI.


/**
* Represents a binding between a text input control and an auto-completion popup
* Represents a binding between a text input control and an auto-completion popup.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great fix!

* This class is a slightly modified version of {@link impl.org.controlsfx.autocompletion.AutoCompletionTextFieldBinding}
* that works with general text input controls instead of just text fields.
* <p>
* Use the {@link Builder} to create instances of this class.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

};

/**
* Private constructor to enforce the use of Builder.
Copy link
Collaborator

Choose a reason for hiding this comment

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

As you now know, no javadoc for private members.

* .inputAnalyzer(new CustomStrategy())
* .showOnFocus(true)
* .build();
* }</pre>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice

* @param <T> the type of the suggestions
*/
public static class Builder<T> {
// Required parameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

good comments

/**
* Represents the link to an external file (e.g. associated PDF file).
* This class is {@link Serializable} which is needed for drag and drop in gui
* This class is {@link Serializable} which is needed for drag and drop in gui.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good.

* Constructor can also be used for non-valid paths. We need to parse them, because the GUI needs to render it.
*
* @param description the file description
* @param link the file link as string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Normally, you wouldn't say "as string" because the type information is shown in javadoc anyway.


/**
* Creates a LinkedFile from a local file path.
* This is the most common way to create a LinkedFile for local files.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would not include information like this in javadoc since it's not part of the API.

*
* @param description the file description
* @param link the file path
* @param fileType the file type, e.g., "PDF", "TXT"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I notice that the @param descriptions here are different from the ones in similar methods. They should ideally all be the same.

* @param fileType the file type, e.g., "PDF", "TXT"
* @return a new LinkedFile instance
*/
public static LinkedFile of(String description, Path link, String fileType) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see my instructions were unclear. I did not mean for the static factory methods to all have the same name. For example, this one could be called fromPath() or createFromPath().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Builder pattern for class with multiple overlapping constructors

3 participants