redhat-developer / redhat-developer/vscode-java

Find references on annotation attributes should not take annotated type into account

Open
#3,808 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I have a class starting like this:

@Controller
@RequestMapping("/owners/{ownerId}")
@Profile("cloud")
class PetController {

It looks like executing Go To References while clicking on the annotation attributes uses the annotated type as the element to find references for - which should not be the case in my opinion.

Example:

  • clicking on @Controller and executing Go To References shows all references to the Controller type. 👍
  • same for @Profile etc. 👍
  • clicking on PetController and executing Go To References shows all the references to the PetController type. 👍

But:

  • clicking on the "cloud" annotation attribute and executing Go To References shows all the references to the PetController type as well. 😱 This should return no references, I think.

Background:
We have functionality in place in the Spring Tools that finds references to that specific "cloud" attribute in your code, but the results gets merged with references to the PetController type, which is not a great result (at least from what we are trying to achieve) 😀

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Go To References behavior in VS Code Java using the annotation example, starting from the reference-search handling for annotation attributes. Verify that selecting "cloud" does not include PetController type references, while selections on @Controller, @Profile, and PetController retain their expected results.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.