Skip to content

[javadoc] Remove stale @throws from CSVFormat.withRecordSeparator(String) - #645

Closed
sergiparpal wants to merge 1 commit into
apache:masterfrom
sergiparpal:javadoc-withRecordSeparator
Closed

sergiparpal wants to merge 1 commit into
apache:masterfrom
sergiparpal:javadoc-withRecordSeparator

Conversation

@sergiparpal

Copy link
Copy Markdown

The Javadoc of the deprecated CSVFormat.withRecordSeparator(String) says:

@throws IllegalArgumentException if recordSeparator is none of CR, LF or CRLF

CSVFormat has no such check. 43560d9 added one to validate() in July 2014, and bb54feb removed it four days later, together with the matching @throws of withRecordSeparator(char), but left this one. CSVFormat.DEFAULT.withRecordSeparator("abc") returns a format whose record separator is "abc", as Builder.setRecordSeparator(String) does; that method's Javadoc has no @throws.

This PR removes the stale @throws. It changes Javadoc only.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? Claude Code. Runs with Claude Sonnet 5 flagged the mismatch; Claude Opus 5.5 checked it against the code and the project history, and wrote the change and this description.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice. Not applicable: the change is to Javadoc only.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

…ing)

The Javadoc says the method throws IllegalArgumentException if the
record separator is none of CR, LF or CRLF. CSVFormat has no such
check: 43560d9 added one to validate() in July 2014, and bb54feb
removed it four days later together with the @throws of
withRecordSeparator(char), but left this one. The method accepts any
string, like Builder.setRecordSeparator(String), whose Javadoc has no
@throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@garydgregory
garydgregory marked this pull request as draft November 29, 2026 15:21
@garydgregory

Copy link
Copy Markdown
Member

@sergiparpal
Thank you for the PR but this one is incorrect: Follow the call chain to validate(). I improved the Javadoc in commit 2b38814

@sergiparpal

Copy link
Copy Markdown
Author

Thanks for the review, and for 2b38814: it replaces the CR/LF/CRLF condition this PR was about. Closing in favor of that commit.

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.

2 participants