-
Notifications
You must be signed in to change notification settings - Fork 214
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
Updated Existing Converters #49
base: master
Are you sure you want to change the base?
Conversation
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.
Really good improvements IMHO.
Looks like your EnumConverter test is failing the build? |
Ahh shoot, I'll fix that then. 🤔 I actually just noticed a small differences between the old and new EnumConverter, though. I was going to change it back, but want to verify something first, as that might not be ideal: public enum SpecialEnum {
HELLO,
hello
} Despite the fact it breaches naming conventions, it's technically still possible to have multiple enum constants with the same name if we ignore case, so I think it's better to be case-sensitive to avoid choosing the wrong one. I think changing it to case-sensitive might be considered a breaking change, though? |
I think if you look a the history Enum is a new converter for 2.0 which has not been released and never existing in 1.9.X branch so you should be OK and it shouldn't be a breaking change. |
Not 100% sure why, but seems on Java 8 I need to add a cast to Enum. 🤔 |
Can you bump your Jacoco in pom.xml 0.8.6 so it fixes the build and retriggers please? |
e01e8cb
to
0a6efa1
Compare
I've rebased the PR with |
0a6efa1
to
7ed7274
Compare
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.
@SethFalco
Thank you for your PR. This PR is almost to big. Please see my comments.
src/main/java/org/apache/commons/beanutils2/converters/CharacterConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/CharacterConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/DurationConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/PeriodConverter.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/ConverterTestSuite.java
Outdated
Show resolved
Hide resolved
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.
@SethFalco
Thank you for your PR. This PR is almost too big. Please see my comments. It might be simpler, depending on your reply, of splitting up this PR into smaller ones which would expedite non-controversial changes like the addition of new converters vs. changing existing ones.
G.
@garydgregory Some of your comments related to code format could be resolved by defining IDE specific code formatter. WDYT. |
Yes that is why I have added a PR here to implement Spotless plugin so the code stays formatted to project standards no matter what IDE is used! |
What @melloware suggested is much more appealing in general, coming from an IntelliJ user who is aware some other contributors are using Eclipse. It'd be better as a Maven/Gradle build task, Travis/GitHub action, or anything that does not bind the contributor to a particular IDE. |
I get it but we would have to provide a consistent approach for all components in Apache Commons IMO. We could start with just one. Right now we use Checkstyle, so we would have to convert each component's checkstyle configuration to a new system. Yes, ideally we could have one rule set for all of Commons but we don't beyond use spaces not tabs. Anyway, please feel free to bring this up on the dev mailing list. |
7ed7274
to
741be02
Compare
741be02
to
ed13c38
Compare
I've rebased with master, squashed my commits, and resolved all feedback. High hopes everything is cool, but I'll be available if you have any other comments. I opted to stick to updating this PR for now rather than split it, since it's getting smaller anyway. (Let me know if that's a problem!) I left some changes in converters I reverted, for example:
|
90b179a
to
f31a69c
Compare
570d20b
to
67eae9f
Compare
I've rebased this pull request with I'd also migrated the test cases modified in this PR to JUnit 5, as that API is already being used in other files in the repository. Reference: Edit: And I've rebased again following the merge of #47 |
67eae9f
to
d7c8bba
Compare
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.
Hi @SethFalco
Thank you for your update. Please see minor scattered comments.
src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/CharacterConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/apache/commons/beanutils2/converters/InstantConverter.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/CharacterConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/commons/beanutils2/converters/EnumConverterTestCase.java
Outdated
Show resolved
Hide resolved
d7c8bba
to
185d533
Compare
Thanks for the review. I've rebased and made all requested changes. Edit: Just rebased and re-requested review. My bad, I have a bad habit of posting a comment instead of using the re-request review button. |
185d533
to
e784410
Compare
This updates existing converters to the implementations referenced in #47. All existing test cases pass, and new ones have been added.
Character
Accepts hexadecimal representation for characters, to specify a character with its character code.
(I've worked somewhere where we couldn't put
£
or€
in the source. ^-^')Enum
Accepts types of the
Enum
class, for example instead of assigning to the rawEnum
type, it can accept input fromjava.time.DayOfWeek#MONDAY
orjava.time.DayOfWeek.MONDAY
to get the constantMONDAY
from theDayOfWeek
enum.Instant
Can now convert Instants (another chrono type).