Repository navigation
Fix FileuploadToFileUpload2 package migration and milestone version - #1322
Merged
Merged
Conversation
timtebeek
commented
Oct 20, 2026
Comment on lines
+30
to
+31
| spec.recipeFromResources("org.openrewrite.java.migrate.jakarta.FileuploadToFileUpload2") | ||
| .parser(JavaParser.fromJavaVersion().dependsOn( |
Member
Author
There was a problem hiding this comment.
Type table and classpath from resources
…ge-migration # Conflicts: # build.gradle.kts # src/test/resources/META-INF/rewrite/classpath.tsv.gz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed
FileuploadToFileUpload2(part ofJavaxMigrationToJakarta) swapped the dependency but never migrated any Java code, and one of its dependency swaps produced a version that doesn't exist. Follow-up to #1320.1. Package moves never matched
All three
ChangePackagesteps usedorg.apache.commons.fileload…instead oforg.apache.commons.fileupload…. The typo was on both the old and new side, and has been there since #819. That package never existed, so the steps were no-ops. Projects ended up oncommons-fileupload2-jakarta-servlet5with their imports still pointing at FileUpload 1.x.org.apache.commons.fileupload.disk→org.apache.commons.fileupload2.coreorg.apache.commons.fileupload.servlet→org.apache.commons.fileupload2.jakarta.servlet5org.apache.commons.fileupload→org.apache.commons.fileupload2.coreThe servlet classes were also renamed in FileUpload 2, so a package move alone would point at types that don't exist. These
ChangeTypesteps now run before the package moves:jakarta.servlet5)servlet.ServletFileUploadJakartaServletFileUploadservlet.ServletRequestContextJakartaServletRequestContextservlet.FileCleanerCleanupJakartaFileCleanerThe display name and description had the same typo; both now describe what the recipe does, and
recipes.csvis updated to match.2.
commons-fileupload2-jakartaswap produced a nonexistent versionThe
commons-fileupload2-jakarta→commons-fileupload2-jakarta-servlet5swap had nonewVersion, so it kept the old version. That artifact only ever had2.0.0-M1, and servlet5 starts at2.0.0-M2, so the result wascommons-fileupload2-jakarta-servlet5:2.0.0-M1, which doesn't exist. It now setsnewVersion: 2.0.0-M5, the same as the 1.x swap.The milestone's classes have the same names as servlet5's but live in
org.apache.commons.fileupload2.jakarta. A non-recursiveChangePackagenow moves them toorg.apache.commons.fileupload2.jakarta.servlet5.Not covered
These changes put imports and type references in the right packages. Other FileUpload 2 API changes still need manual work:
DiskFileItemFactory.builder(), the genericFileItem/JakartaServletFileUploadtypes, and renames such asFileItemStream→FileItemInput. Portlet support andorg.apache.commons.fileupload.utilhave no direct equivalent in FileUpload 2.Testing
FileuploadToFileUpload2Testgains four tests:commons-fileupload2-jakarta:2.0.0-M1→commons-fileupload2-jakarta-servlet5:2.0.0-M5fileupload2.jakartamilestone package →fileupload2.jakarta.servlet5jakarta.servlet5code is left untouchedThree of the new tests fail against
mainand pass with this change; the fourth checks for no change, so it passes either way.JavaxToJakartaTest,JakartaEE10TestandJakartaEE11Testpass.