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

Ability to match on methods/functions/constructors with particular signatures #467

Open
jmle opened this issue Jan 11, 2024 · 5 comments
Open
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. provider/java triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@jmle
Copy link
Contributor

jmle commented Jan 11, 2024

The analyzer should have the ability to match on methods, functions or constructors that are passed a specific argument type, for instance:

java.referenced:
  location: CONSTRUCTOR
  pattern: java.lang.String\(java.lang.StringBuilder\)

would match on:

StringBuilder arg = new StringBuilder("Hello World!")'
String str = new String(arg);

but not on:

String arg = "Hello World!";
String str = new String(arg);

We could either escape the parenthesis of the method call, as done in the yaml example above, or add an additional field, as in:

java.referenced:
  location: CONSTRUCTOR
  arguments:
    - java.lang.String
  pattern: java.lang.String(*)
@shawn-hurley
Copy link
Contributor

Do we have customer's asking for this or is this preemptive? if we do have windup rules that have this how many?

just want to understand the relative importance of this feature

@jmle
Copy link
Contributor Author

jmle commented Jan 11, 2024

There seem to be a few:
image

I wouldn't say it's super important, but if it can be achieved we should definitely add it at some point.

@shawn-hurley
Copy link
Contributor

shawn-hurley commented Jan 11, 2024

That makes sense to add it, I am not at all opposed, was trying to get a sense of how important it is

@jmle jmle changed the title [RFE] Ability to match on methods/functions/constructors with particular argument types [RFE] Ability to match on methods/functions/constructors with particular signatures Feb 2, 2024
@jmle jmle added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Feb 7, 2024
@konveyor-ci-bot konveyor-ci-bot bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 7, 2024
@konveyor-ci-bot
Copy link

This issue is currently awaiting triage.
If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members.

@konveyor-ci-bot konveyor-ci-bot bot added the needs-kind Indicates an issue or PR lacks a `kind/foo` label and requires one. label Feb 7, 2024
@konveyor-ci-bot
Copy link

This issue is currently awaiting triage.
If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members.

@pranavgaikwad pranavgaikwad added kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-kind Indicates an issue or PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2024
@dymurray dymurray added this to the v0.5.0 milestone Jun 6, 2024
@dymurray dymurray changed the title [RFE] Ability to match on methods/functions/constructors with particular signatures Ability to match on methods/functions/constructors with particular signatures Jun 20, 2024
@jmle jmle self-assigned this Jul 9, 2024
shawn-hurley pushed a commit that referenced this issue Jul 22, 2024
This PR adds support for inspecting annotations.

:green_circle: Things that can be done now:
- Check for annotations that are annotating specific
`FIELD_DECLARATION`, `METHOD_DECLARATION` or `TYPE`
- Match against `METHOD_DECLARATION`

:red_circle: Things that cannot be done **yet**:
- Match `location: ANNOTATION` and inspect its values.
- Inspect on annotations on `location: CONSTRUCTOR`.

Depends on:
- konveyor/java-analyzer-bundle#104

Fixes:
- #460
- #467

---------

Signed-off-by: Juan Manuel Leflet Estrada <jleflete@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. provider/java triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: ✅ Done
Development

No branches or pull requests

4 participants