rewrite-migrate-java
rewrite-migrate-java copied to clipboard
OpenRewrite recipes for migrating to newer versions of Java.
This [came up in Slack](https://rewriteoss.slack.com/archives/C01A843MWG5/p1675780454761369); when upgrading to newer versions of Java a common step is to also replace the Docker base images in the [`FROM` line in `Dockerfile`s](https://docs.docker.com/engine/reference/builder/#from). Pending...
Java 10 recommends orElseThrow instead of get: https://docs.oracle.com/javase/10/docs/api/java/util/Optional.html#get() Some background: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-April/040531.html ```java val value = Optional.of("").get(); ``` ```java val value = Optional.of("").orElseThrow(NoSuchElementException::new); ```
test case: ```kotlin @Test fun `adds java version property if not present if spring-like parent`() = rewriteRun( pomXml(""" 4.0.0 org.sample sample 1.0.0 org.springframework.boot spring-boot-starter-parent 2.7.0 """.trimIndent(), """ 4.0.0 org.sample sample...
Came across this trade-off and migration analysis for Google auto value versus Java records: https://github.com/google/auto/blob/main/value/userguide/records.md#translating-an-autovalue-class-into-a-record Interesting analysis, and already reads like a migration recipe with the before and after samples,...
I believe that this depends on official Java 16 support . I am logging it now so we remember to do it ```java jshell> var numbers = List.of("1","2","3","4","5") numbers ==>...
Add migration recipe for https://github.com/eclipse-ee4j/jaxb-api/releases/tag/4.0.0
### Problem An import was added but the code was not otherwise changed ### Expected behavior The import shouldn't have change without the change happening elsewhere in the code to...
We'd like to have recipes to migrate from [immutables](http://immutables.github.io/) to Java records Starting with the introduction of records, we do not see a need to use immutables moving forward This...
```java /** * Gets the {@code subject} (subject distinguished name) value * from the certificate. If the {@code subject} value is empty, * then the {@code getName()} method of the...