refactor: disambiguate method names and overloads - #19825
Open
FrankChen021 wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
MissingOverriderule 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Created by the GPT-5.6-Sol model.
Summary
MissingOverriderule in the normal Maven static-check lifecycleHttpRemoteTaskRunnerworker-info accessor caught by that ruleMost 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 -T1Cmvn -ntp -B checkstyle:check -pl processing,server,indexing-service,extensions-core/kafka-indexing-service -Dweb.console.skip=true -DskipTestsmvn -ntp -B test-compile -pl processing,server,indexing-service,extensions-core/kafka-indexing-service -am -Dweb.console.skip=true -DskipTests -T1C