Few more Java 17 syntax improvements.#697
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #697 +/- ##
============================================
+ Coverage 92.50% 92.51% +0.01%
- Complexity 2603 2604 +1
============================================
Files 283 283
Lines 5295 5291 -4
Branches 568 565 -3
============================================
- Hits 4898 4895 -3
Misses 251 251
+ Partials 146 145 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| appender.append(String.valueOf(pad).repeat(Math.max(0, length - string.length()))); | ||
| appender.append(string); | ||
| return appender.toString(); |
There was a problem hiding this comment.
no need for StringBuilder here
There was a problem hiding this comment.
Why not? What's the alternative?
There was a problem hiding this comment.
return String.valueOf(pad).repeat(Math.max(0, length - string.length())) + string;There was a problem hiding this comment.
Ah, like that. Yes, yes, can do.
| case UPPERCASE -> upperCaseValue; | ||
| case LOWERCASE -> lowerCaseValue; | ||
| case CAPITAL -> capitalValue; | ||
| default -> throw new IllegalArgumentException("Unknown case " + caze); |
There was a problem hiding this comment.
what happens if someone adds a new value to enum and forgets to update this switch?
With default exception the problem could be detected immediately.
How to detect it without default?
| return List.of(TestSpec.of(astralia::locations, "australia.locations"), | ||
| TestSpec.of(astralia::animals, "australia.animals"), | ||
| TestSpec.of(astralia::states, "australia.states")); | ||
| Australia australia = faker.australia(); |
There was a problem hiding this comment.
Ugh, sorry that was me
There was a problem hiding this comment.
I didn't check, I feared it was me :-)

No description provided.