-
Notifications
You must be signed in to change notification settings - Fork 190
Few more Java 17 syntax improvements. #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for StringBuilder
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? What's the alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return String.valueOf(pad).repeat(Math.max(0, length - string.length())) + string;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, like that. Yes, yes, can do.
@@ -484,7 +484,6 @@ public String getValue(Case caze) { | |||
case UPPERCASE -> upperCaseValue; | |||
case LOWERCASE -> lowerCaseValue; | |||
case CAPITAL -> capitalValue; | |||
default -> throw new IllegalArgumentException("Unknown case " + caze); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok then
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, sorry that was me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check, I feared it was me :-)
No description provided.