prismicio-community / java-kit

Community maintained development kit for Prismic and the Java language
https://prismic.io
15 stars 38 forks source link

[enhancement] Migrate to Java 8 #64

Closed damienbeaufils closed 6 years ago

damienbeaufils commented 6 years ago

Hello Prismic team,

Now we are in 2018, I think it is time to move to a Java 8 baseline :-) Java 7 has reached its EOL in 2015, and Java 8 EOL is near (now Java 9 is out and Java 18.x is expected soon). Furthermore, Play Framework requires Java 8, as well as Spring 5 (and Spring Boot 2).

With Java 8, we will be able to use Streams, Java Time, Lambdas, Default methods, Optional and so on! We also will be able to use reactive programming with library such as Reactor.

This PR migrates the whole code to Java 8. There are a lot of code updates in this PR, but most of changes have been made with IntelliJ IDEA 2017.3 Ultimate inspection tool. All the automatic code fixes done by IntelliJ are in the commits prefixed with Automatic IntelliJ IDEA fix:. The other commits are manual fixes.

The java-kit version in pom.xml has been bumped to 2.0.0, because of the Java 8 baseline requirement. The README has been also updated.

Thanks!

arnaudlewis commented 6 years ago

Hello @damienbeaufils, Thanks for this PR this is a great initiative. I’ll take a look ASAP. And thanks for all these explanations.

arnaudlewis commented 6 years ago

I think this PR is interesting, but since we decide to jump to java 8, it would be interesting to remove all the null and null check in the kit and put some optionals. For example, we have a few check on the accessToken which is not mandatory, we could have an Optional instead. What do you think about that?

damienbeaufils commented 6 years ago

@arnaudlewis I agree. But I think it would be better in a next PR, because there are already a lot of changes in this one :). When this PR will be merged, any contributor could work on using more stuff of Java 8, like Optionals and Java Time. (I'm interested to work on it ;))

Patouche commented 6 years ago

Yes, I'm agree with you. It will be nice to remove Joda Time and to use the Java Time api. I can also participate for any clean.

damienbeaufils commented 6 years ago

@arnaudlewis @Patouche We could create github issues to list all the refactoring we should do after merging this PR

Aigrefin commented 6 years ago

Hello, I agree with merging this PR as a first step. Do you know when it could be done ?

arnaudlewis commented 6 years ago

@damienbeaufils sounds good to me for the issues. The PR seems okay for me, We'll run a few tests on our side to make sure it's stable and I'll release it. Probably in the next couple days.

damienbeaufils commented 6 years ago

@arnaudlewis Ok, thanks!

damienbeaufils commented 6 years ago

@Patouche Joda-Time has been replaced by Java 8 Time API in #66, which depends on this PR.