Skip to content

refactor: disambiguate method names and overloads - #19825

Open
FrankChen021 wants to merge 3 commits into
apache:masterfrom
FrankChen021:agent/fix-api-contract-naming
Open

refactor: disambiguate method names and overloads#19825
FrankChen021 wants to merge 3 commits into
apache:masterfrom
FrankChen021:agent/fix-api-contract-naming

Conversation

@FrankChen021

Copy link
Copy Markdown
Member

Created by the GPT-5.6-Sol model.

Summary

  • enable PMD's MissingOverride rule in the normal Maven static-check lifecycle
  • add a PMD rule that rejects same-class method names differing only by capitalization, while excluding inherited API overrides
  • rename the conflicting HttpRemoteTaskRunner worker-info accessor caught by that rule
  • give safe private and test-only overloads semantic names so callers cannot silently bind to a more-specific overload
  • clarify the cache configuration test names that previously differed only by capitalization

Most missing-override findings in the broader CodeQL pattern are generated sources. The only handwritten IntSet.clone() finding is not a valid Java override and cannot accept @Override. Required Servlet/interface overloads and compatibility APIs are intentionally preserved.

Verification

  • mvn -ntp -B pmd:check -Dweb.console.skip=true -DskipTests -T1C
  • mvn -ntp -B checkstyle:check -pl processing,server,indexing-service,extensions-core/kafka-indexing-service -Dweb.console.skip=true -DskipTests
  • mvn -ntp -B test-compile -pl processing,server,indexing-service,extensions-core/kafka-indexing-service -am -Dweb.console.skip=true -DskipTests -T1C
  • 68 focused tests across parser, nested expressions, group-by, sorting, cache configuration, and the affected Kafka supervisor paths

@FrankChen021
FrankChen021 marked this pull request as ready for review July 30, 2026 19:42
Copilot AI review requested due to automatic review settings July 30, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens static analysis and reduces ambiguity caused by confusingly similar method names/overloads across Druid’s Java codebase, primarily by enabling additional PMD checks and renaming methods/tests to be more semantically explicit.

Changes:

  • Enables PMD’s MissingOverride rule and adds a custom PMD XPath rule to prevent same-class methods differing only by capitalization (excluding inherited overrides).
  • Renames ambiguous/private/test helper methods to more descriptive names to avoid accidental overload binding.
  • Renames cache configuration tests that previously differed only by capitalization, and adjusts a task-runner test expectation for blacklisted capacity reporting.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/src/test/java/org/apache/druid/client/cache/CacheConfigTest.java Renames FALSE-related tests to avoid capitalization-only name differences.
processing/src/test/java/org/apache/druid/query/operator/NaiveSortOperatorTest.java Renames helper to clarify it builds RACs from array inputs and updates callers.
processing/src/test/java/org/apache/druid/math/expr/ParserTest.java Renames scalar constant helper to clarify overload intent and updates scalar call sites.
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/GroupByQueryEngine.java Renames private overload targets to make int-grouper-specific aggregation explicit.
processing/src/main/java/org/apache/druid/query/expression/NestedDataExpressions.java Renames ExprEval-unwrapping helper and updates call sites for clearer intent.
indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java Adds an assertion that blacklisted task-slot counts are empty in the exercised scenario.
indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java Renames worker-info accessor to avoid confusing capitalization and updates internal usage.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java Renames a test helper to clarify it derives tasks from supervisor tuning config.
codestyle/pmd-ruleset.xml Adds MissingOverride and a custom rule preventing case-only method-name differences within a class.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants