Croway opened a new issue, #106:
URL: https://github.com/apache/camel-upgrade-recipes/issues/106

   ## Description
   
   The `UpgradeSpringBoot3To4` recipe in `camel-spring-boot-upgrade-recipes` 
unconditionally sets `java.version`, `maven.compiler.source`, 
`maven.compiler.target`, and `maven.compiler.release` properties to `17`, even 
when the project already uses a higher version (e.g., 21 or 25).
   
   ## Location
   
   
`camel-spring-boot-upgrade-recipes/src/main/resources/META-INF/rewrite/spring-boot-3-to-4.yaml`
 (lines 26-37):
   
   ```yaml
   - org.openrewrite.maven.ChangePropertyValue:
       key: java.version
       newValue: "17"
   - org.openrewrite.maven.ChangePropertyValue:
       key: maven.compiler.source
       newValue: "17"
   - org.openrewrite.maven.ChangePropertyValue:
       key: maven.compiler.target
       newValue: "17"
   - org.openrewrite.maven.ChangePropertyValue:
       key: maven.compiler.release
       newValue: "17"
   ```
   
   `ChangePropertyValue` performs a blind replacement without comparing the 
existing value.
   
   ## Reproduction
   
   1. Take a Camel Spring Boot project with `<java.version>21</java.version>` 
(e.g., [camelbee/camelbee](https://github.com/camelbee/camelbee) or 
[piomin/sample-camel-spring-boot](https://github.com/piomin/sample-camel-spring-boot))
   2. Run the `CamelSpringBootMigrationRecipe`
   3. Observe that `java.version`, `maven.compiler.source`, and 
`maven.compiler.target` are all downgraded from 21 to 17
   
   ## Expected behavior
   
   Java 17 should be treated as a **minimum floor**, not an unconditional 
target. Projects already on Java 21+ should not be downgraded.
   
   ## Note
   
   The `UpgradeJavaVersion` recipe in `camel-upgrade-recipes` (used by 
`JavaVersion17`) already handles this correctly — it checks `getMajorVersion() 
< version` before updating Java markers. But the `ChangePropertyValue` calls in 
`spring-boot-3-to-4.yaml` bypass that logic entirely.
   
   ## Suggested fix
   
   Remove the four `ChangePropertyValue` calls from `spring-boot-3-to-4.yaml`, 
since `UpgradeToJava17` and `JavaVersion17` (which are already invoked 
elsewhere in the recipe chain) handle Java version upgrades correctly with 
floor semantics.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to