Fix non-standard variable naming in Java test files by using static final#2
Open
Copilot wants to merge 3 commits into2.x_25_10_16_02from
Open
Fix non-standard variable naming in Java test files by using static final#2Copilot wants to merge 3 commits into2.x_25_10_16_02from
Copilot wants to merge 3 commits into2.x_25_10_16_02from
Conversation
Co-authored-by: slievrly <8758457+slievrly@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze and correct variable naming conventions in Java code
Fix non-standard variable naming in Java test files
Oct 16, 2025
slievrly
reviewed
Oct 16, 2025
common/src/test/java/org/apache/seata/common/thread/RejectedPoliciesTest.java
Outdated
Show resolved
Hide resolved
…ad of renaming to camelCase Co-authored-by: slievrly <8758457+slievrly@users.noreply.github.com>
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Fix non-standard variable naming in Java test files
Fix non-standard variable naming in Java test files by using static final
Oct 16, 2025
Owner
|
@copilot 请继续检查变量,方法和接口的命名是否符合Java规范并修复它。可能你需要更高级别的规范约束来检查Java代码。 |
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.
Description
This PR fixes non-standard variable naming issues in Java test files where instance variables (non-static final fields) were incorrectly using uppercase or UPPER_SNAKE_CASE naming. The fix makes these variables proper constants by changing them from
private finaltoprivate static final.Problem
According to Java naming conventions:
xid,maxCompressedSize,defaultXid)MAX_SIZE,DEFAULT_TIMEOUT)Several test files in the codebase were violating this convention by using
private finalwith uppercase naming for what should be constants, which can be confusing and makes the code less maintainable.Solution
Changed
private finaltoprivate static finalto make these variables proper constants, keeping the UPPER_SNAKE_CASE naming convention. This approach is more semantically correct as these are test constants that should be shared across all instances rather than duplicated per instance.Changes
Fixed variable naming in 10 test files across multiple modules:
Core Module
ContextCoreTest.java: Changedprivate finaltoprivate static finalfor FIRST_KEY, FIRST_VALUE, SECOND_KEY, SECOND_VALUE, NOT_EXIST_KEYRootContextTest.java: Changedprivate finaltoprivate static finalfor DEFAULT_XID, DEFAULT_BRANCH_TYPEGlobalBeginResponseTest.java: Changedprivate finaltoprivate static finalfor XID, EXTRA_DATA, RESULT_CODEIntegration Module
GrpcTest.java: Changedprivate finaltoprivate static finalfor XIDOther Modules
ZstdUtilTest.java: Changedprivate finaltoprivate static finalfor MAX_COMPRESSED_SIZETableMetaTest.java: Changedprivate finaltoprivate static finalfor COLUMN_ID, COLUMN_USERCODERejectedPoliciesTest.java: Changedprivate finaltoprivate static finalfor DEFAULT_CORE_POOL_SIZE, DEFAULT_KEEP_ALIVE_TIME, MAX_QUEUE_SIZEApplicationKeeper.java: Changedprivate finaltoprivate static finalfor LOCK, STOPApolloMockServer.java: Changedprivate finaltoprivate static finalfor CONFIG_PREFIX_PATHClusterWatcherManagerTest.java: Changedprivate finaltoprivate static finalfor TEST_GROUP, TEST_TIMEOUT, TEST_TERM, TEST_CLIENT_ENDPOINTExample
Before:
After:
Benefits
static finalwith UPPER_SNAKE_CASE namingstatickeyword, keeping variable names unchangedThis change improves code correctness and adherence to Java coding standards without affecting any functionality.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.