Skip to content

Add notes for Faces 4.0 FacesManagedBeansRemoved#1025

Merged
timtebeek merged 3 commits intoopenrewrite:mainfrom
evie-lau:faces4Notes
Mar 23, 2026
Merged

Add notes for Faces 4.0 FacesManagedBeansRemoved#1025
timtebeek merged 3 commits intoopenrewrite:mainfrom
evie-lau:faces4Notes

Conversation

@evie-lau
Copy link
Contributor

@evie-lau evie-lau commented Mar 23, 2026

What's changed?

Add notes in recipe for future enhancements

What's your motivation?

@evie-lau evie-lau self-assigned this Mar 23, 2026
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Mar 23, 2026
@timtebeek
Copy link
Member

timtebeek commented Mar 23, 2026

@timtebeek
Copy link
Member

Analysis: What's needed for the two TODO items

1. @ManagedProperty name attribute removal

Problem: After the existing ChangeType migrates jakarta.faces.bean.ManagedPropertyjakarta.faces.annotation.ManagedProperty, the name attribute causes a compile error because Faces 4.0's @ManagedProperty doesn't have a name element.

Solution: The existing org.openrewrite.java.RemoveAnnotationAttribute recipe from rewrite-java core handles this — no custom Java code needed. Just add a YAML entry after the ChangeType steps:

- org.openrewrite.java.RemoveAnnotationAttribute:
    annotationType: jakarta.faces.annotation.ManagedProperty
    attributeName: name

Only the post-migration type (jakarta.faces.annotation.ManagedProperty) is needed since ChangeType runs first in the recipe list.

2. @CustomScoped migration

Problem: jakarta.faces.bean.CustomScoped was removed in Faces 4.0 with no direct replacement. The CDI equivalent involves defining a custom scope annotation with @NormalScope or @Scope, plus registering a Context implementation — this is NOT a simple ChangeType.

Status: This would require a custom Java recipe and the migration path isn't mechanical (the issue author also notes "unsure of recipe scope, and if feasible"). Skipping for now.

@timtebeek
Copy link
Member

Thanks again! Does that removal through RemoveAnnotationAttribute make sense to you? Or would that lose something we still need to migrate?

@evie-lau
Copy link
Contributor Author

Does that removal through RemoveAnnotationAttribute make sense to you? Or would that lose something we still need to migrate?

I have no personal experience with usage of these annotations, but it seems to make sense to me.
The current case is compilation error. And with removing the attribute, it seems the name is automatically based on the annotated field's name.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 23, 2026
@timtebeek timtebeek merged commit 8ff2f5b into openrewrite:main Mar 23, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 23, 2026
@evie-lau evie-lau deleted the faces4Notes branch March 23, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants