Optimization of enumerated values method#2677
Optimization of enumerated values method#2677davidzollo merged 10 commits intoapache:devfrom CalvinKirs:enum
Conversation
…, it is not recommended to use the value method. Specifically see jmh results
| COMMAND_TYPE_MAP.put(0, START_PROCESS); | ||
| COMMAND_TYPE_MAP.put(1, START_CURRENT_TASK_PROCESS); | ||
| COMMAND_TYPE_MAP.put(2, RECOVER_TOLERANCE_FAULT_PROCESS); | ||
| COMMAND_TYPE_MAP.put(3, RECOVER_SUSPENDED_PROCESS); | ||
| COMMAND_TYPE_MAP.put(4, START_FAILURE_TASK_PROCESS); | ||
| COMMAND_TYPE_MAP.put(5, COMPLEMENT_DATA); | ||
| COMMAND_TYPE_MAP.put(6, SCHEDULER); | ||
| COMMAND_TYPE_MAP.put(7, REPEAT_RUNNING); | ||
| COMMAND_TYPE_MAP.put(8, PAUSE); | ||
| COMMAND_TYPE_MAP.put(9, STOP); | ||
| COMMAND_TYPE_MAP.put(10, RECOVER_WAITTING_THREAD); |
There was a problem hiding this comment.
do you have better idea? I think the map key will be easy to make wrong with the enum self , actually , it write twice now, these number will be easy to wrong
There was a problem hiding this comment.
do you have better idea? I think the map key will be easy to make wrong with the enum self , actually , it write twice now, these number will be easy to wrong
I have completed the change, please review
Codecov Report
@@ Coverage Diff @@
## dev #2677 +/- ##
============================================
- Coverage 37.16% 36.93% -0.23%
+ Complexity 2548 2535 -13
============================================
Files 433 433
Lines 19958 19967 +9
Branches 2423 2423
============================================
- Hits 7417 7375 -42
- Misses 11876 11929 +53
+ Partials 665 663 -2 Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## dev #2677 +/- ##
============================================
- Coverage 37.14% 37.08% -0.07%
+ Complexity 2555 2551 -4
============================================
Files 434 434
Lines 20006 20015 +9
Branches 2426 2426
============================================
- Hits 7432 7422 -10
- Misses 11907 11926 +19
Partials 667 667
Continue to review full report at Codecov.
|
|
Kudos, SonarCloud Quality Gate passed!
|
The values method of enum is a deep copy, it is not recommended to use the value method. Specifically see jmh results
Tips
What is the purpose of the pull request
As mentioned above,The value method of enum is a deep copy, it is not recommended to use the value method. Specifically see jmh results.
Brief change log
Optimization of enumerated values method
Verify this pull request
(Please pick either of the following options)
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
jmh test and junit test