Skip to content

🚧 Add annotations to the type attribution for method parameters #5337

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

knutwannheden
Copy link
Contributor

The type attribution for method return types and method parameters currently lack annotations. Recipes might require these annotations to perform their task.

The type attribution for method return types and method parameters currently lack annotations. Recipes might require these annotations to perform their task.
@knutwannheden
Copy link
Contributor Author

knutwannheden commented Apr 24, 2025

The approach in this PR is not complete:

  • We also need to support JavaType.Array, JavaType.Parameterized and JavaType.GenericTypeVariable with annotations. While JavaType.Array already supports annotations, the other two don't.
  • Further, the approach here only works correctly for parsed source code. For Java types loaded from bytecode the code needs to look a bit different.
  • Finally, possibly the annotated types should be cached by including the type use annotations in the signature (cache key).

Copy link
Member

@sambsnyd sambsnyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Apr 24, 2025
@knutwannheden
Copy link
Contributor Author

Just to be clear: This PR can't be merged yet. I just explored some of the possible solutions and created a PR from it, so we have something to start with when we pick this up.

@knutwannheden knutwannheden changed the title Add annotations to the type attribution for method parameters 🚧 Add annotations to the type attribution for method parameters Apr 24, 2025
@timtebeek timtebeek moved this from Ready to Review to In Progress in OpenRewrite May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants