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

RemovalsServletJakarta10 Recipe #338

Merged
merged 27 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cbc7c6d
RemovalsServletJakarta10 Recipe
AnuRam123 Nov 3, 2023
77a905e
push post DeleteMethodArgument fix
AnuRam123 Nov 3, 2023
225a329
cleanup RemovalsServletJakarta10Test.java
AnuRam123 Nov 4, 2023
320c28c
Polish & enable exception test
timtebeek Nov 6, 2023
27a09e8
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Nov 6, 2023
5a0c335
Better expectations
timtebeek Nov 6, 2023
3d6ea26
Remove unused imports
timtebeek Nov 6, 2023
8e39c10
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Nov 7, 2023
dfd8c5e
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Nov 15, 2023
8b86e13
Merge branch 'main' into jakarta_ee_recipe_migration
ranuradh Nov 16, 2023
b0f060d
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Nov 20, 2023
f86caa0
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Nov 20, 2023
d3d7cb1
Restore jakarta-ee-10.yml
timtebeek Nov 20, 2023
6b29a95
remove annotations and rename class file
AnuRam123 Nov 27, 2023
2701895
Update src/main/java/org/openrewrite/java/migrate/jakarta/UpdateGetRe…
timtebeek Nov 28, 2023
7913b64
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Dec 11, 2023
c609d5f
Merge branch 'main' into jakarta_ee_recipe_migration
ranuradh Jan 9, 2024
a8909db
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Jan 17, 2024
4ed019d
Merge branch 'main' into jakarta_ee_recipe_migration
cjobinabo Jan 19, 2024
91774c2
should resolve tests
cjobinabo Jan 19, 2024
43ea9a2
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Jan 22, 2024
56d4d9d
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Jan 28, 2024
20a49b2
Merge branch 'main' into jakarta_ee_recipe_migration
timtebeek Jan 30, 2024
6739ed8
Remove Faces recipes that were split off
timtebeek Jan 30, 2024
8d733ff
Remove parameters to UpdateGetRealPath & add test
timtebeek Jan 30, 2024
10d1540
Remove optional `ignoreDefinition: true`
timtebeek Jan 30, 2024
9770410
Add missing yaml recipe type
timtebeek Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,36 @@

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jetbrains.annotations.NotNull;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Option;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;
import org.openrewrite.internal.lang.NonNull;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.MethodMatcher;
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.JavaType;

@Value
@EqualsAndHashCode(callSuper = false)
public class GetRealPathUpdate extends Recipe {
public class UpdateGetRealPath extends Recipe {
@Option(displayName = "Method Pattern",
description = "A `jakarta.servlet.ServletRequest` or `jakarta.servlet.ServletRequestWrapper getRealPath(String)` matching required",
example = "jakarta.servlet.ServletRequest getRealPath(String)")
@NonNull String methodPattern;

@Override
public @NotNull String getDisplayName() {
return "Remove methods calls";
public String getDisplayName() {
return "Updates getRealPath() to call getContext() followed by getRealPath()";
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
public @NotNull String getDescription() {
return "Updates `getRealPath()` for `jakarta.servlet.ServletRequest` and `jakarta.servlet.ServletRequestWrapper`";
public String getDescription() {
return "Updates `getRealPath()` for `jakarta.servlet.ServletRequest` and `jakarta.servlet.ServletRequestWrapper` to use `ServletContext.getRealPath(String)`";
}

@Override
public @NotNull TreeVisitor<?, ExecutionContext> getVisitor() {
public TreeVisitor<?, ExecutionContext> getVisitor() {
return new MethodInvocationVisitor(methodPattern);
}

Expand All @@ -60,7 +58,6 @@ private MethodInvocationVisitor(String methodPattern) {
METHOD_PATTERN = new MethodMatcher(methodPattern, false);
}

@Nullable
@Override
public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, ExecutionContext ec) {
if (METHOD_PATTERN.matches(method)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/rewrite/jakarta-ee-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ recipeList:
oldParameterNames: [ str, ex ]
ignoreDefinition: true
matchOverrides: true
- org.openrewrite.java.migrate.jakarta.GetRealPathUpdate:
- org.openrewrite.java.migrate.jakarta.UpdateGetRealPath:
methodPattern: jakarta.servlet.ServletRequest getRealPath(String)
- org.openrewrite.java.migrate.jakarta.GetRealPathUpdate:
- org.openrewrite.java.migrate.jakarta.UpdateGetRealPath:
methodPattern: jakarta.servlet.ServletRequestWrapper getRealPath(String)
- org.openrewrite.java.DeleteMethodArgument:
methodPattern: jakarta.servlet.UnavailableException <constructor>(jakarta.servlet.Servlet, String)
Expand Down
Loading