Skip to content

Fix Finder.index() Javadoc to reflect IllegalArgumentException contract for negative indices#225

Merged
Splatcrafter merged 2 commits into
bugfix/117-118-119-120-121-122-123-api-bugfixesfrom
copilot/sub-pr-223-again
Mar 21, 2026
Merged

Fix Finder.index() Javadoc to reflect IllegalArgumentException contract for negative indices#225
Splatcrafter merged 2 commits into
bugfix/117-118-119-120-121-122-123-api-bugfixesfrom
copilot/sub-pr-223-again

Conversation

Copilot AI commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

The Finder.index() Javadoc claimed negative indices cause get() to return null, but the method has already been throwing IllegalArgumentException at construction time for negative values. The doc was misleading about when and how the failure occurs.

Changes

  • Javadoc correction: Updated description to state that negative indices throw IllegalArgumentException immediately at construction time; out-of-range positive indices are the ones that yield null from get() / root-unchanged from set()
  • Added @throws tag: Explicit @throws IllegalArgumentException on the @param block
  • Updated code example: Added a negative-index snippet showing the throw; clarified the out-of-bounds example comment
  • Removed dead code: set() had an unreachable index < 0 guard — dropped since the constructor already enforces index >= 0
// Throws immediately — does NOT return null from get()
Finder.index(-1); // throws IllegalArgumentException

// Out-of-range positive index — get() returns null, set() returns root unchanged
Finder.index(10).get(dynamicWithThreeElements); // null

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@Splatcrafter Splatcrafter marked this pull request as ready for review March 21, 2026 15:36
@Splatcrafter Splatcrafter marked this pull request as draft March 21, 2026 15:37
…, not null from get()

Co-authored-by: Splatcrafter <83497438+Splatcrafter@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aether-framework/aether-datafixers/sessions/2ba3dec6-7d25-47ab-b4b3-624a4c124efc

Copilot AI commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-61acb3fe8481cff2/dbs/java/working/files-to-index17356626948760299936.list --sourceArchiveDir=/tmp/codeql-scratch-61acb3fe8481cff2/dbs/java/src --outputDir=/tmp/codeql-scratch-61acb3fe8481cff2/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [WIP] Address feedback on removing unused methods and improving core functionality Fix Finder.index() Javadoc to reflect IllegalArgumentException contract for negative indices Mar 21, 2026
Copilot AI requested a review from Splatcrafter March 21, 2026 15:39
@Splatcrafter Splatcrafter marked this pull request as ready for review March 21, 2026 15:39
@Splatcrafter Splatcrafter requested a review from a team as a code owner March 21, 2026 15:39
@Splatcrafter Splatcrafter merged commit 06feff8 into bugfix/117-118-119-120-121-122-123-api-bugfixes Mar 21, 2026
2 checks passed
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