Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SethFalco
Copy link
Contributor

@SethFalco SethFalco commented Nov 4, 2020

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 raw Enum type, it can accept input from java.time.DayOfWeek#MONDAY or java.time.DayOfWeek.MONDAY to get the constant MONDAY from the DayOfWeek enum.

Instant

Can now convert Instants (another chrono type).


  • I've updated test classes for the converters that this affects to JUnit 5.

Copy link
Contributor

@melloware melloware left a 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.

@melloware
Copy link
Contributor

Looks like your EnumConverter test is failing the build?

@SethFalco
Copy link
Contributor Author

SethFalco commented Nov 4, 2020

Looks like your EnumConverter test is failing the build?

Ahh shoot, I'll fix that then. 🤔
Not sure, but this could be because I have JDK 11 as it seems to build/test for me locally. I'll swap out and see if it makes a difference.


I actually just noticed a small differences between the old and new EnumConverter, though.
The original was case-insensitive, but the new one is case-sensitive.

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?
Do you have any thoughts on if I should leave it case-sensitive, or revert it to be non-case sensitive?

@melloware
Copy link
Contributor

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.

@SethFalco
Copy link
Contributor Author

Not 100% sure why, but seems on Java 8 I need to add a cast to Enum. 🤔

@melloware
Copy link
Contributor

Can you bump your Jacoco in pom.xml 0.8.6 so it fixes the build and retriggers please?

@SethFalco
Copy link
Contributor Author

I've rebased the PR with master now, it should be up to date including the JaCoCo 0.8.6 commit.

Copy link
Member

@garydgregory garydgregory left a 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.

Copy link
Member

@garydgregory garydgregory left a 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.

@mohanaraosv
Copy link

@garydgregory Some of your comments related to code format could be resolved by defining IDE specific code formatter. WDYT.

@melloware
Copy link
Contributor

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!

@SethFalco
Copy link
Contributor Author

@garydgregory Some of your comments related to code format could be resolved by defining IDE specific code formatter. WDYT.

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.

@garydgregory
Copy link
Member

@garydgregory Some of your comments related to code format could be resolved by defining IDE specific code formatter. WDYT.

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.

@SethFalco
Copy link
Contributor Author

SethFalco commented Jul 9, 2021

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:

  • updating test cases
  • applying conventions to nearby code to what I was modifying

@SethFalco SethFalco requested a review from garydgregory July 9, 2021 04:06
@SethFalco SethFalco force-pushed the update-converters branch 2 times, most recently from 90b179a to f31a69c Compare October 1, 2021 20:10
@SethFalco SethFalco force-pushed the update-converters branch 2 times, most recently from 570d20b to 67eae9f Compare February 2, 2024 12:47
@SethFalco
Copy link
Contributor Author

SethFalco commented Feb 2, 2024

I've rebased this pull request with master and resolved merge conflicts. Running mvn passes for me locally.

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

Copy link
Member

@garydgregory garydgregory left a 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.

@SethFalco
Copy link
Contributor Author

SethFalco commented Feb 5, 2024

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.

@SethFalco SethFalco force-pushed the update-converters branch from 185d533 to e784410 Compare March 5, 2024 23:00
@SethFalco SethFalco requested a review from garydgregory March 5, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants