eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Searching for annotations with wildcard patterns doesn't work
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 49
Description
When doing a search for annotations with a pattern like:
```java
SearchPattern.createPattern(
"javax.ejb*",
IJavaSearchConstants.TYPE,
IJavaSearchConstants.ALL_OCCURRENCES,
SearchPattern.R_PATTERN_MATCH
)
```
I get matches of import statements of annotations starting with `javax.ejb*`, but no matches with ** usages of annotations**. On the other hand, if I do
```
SearchPattern.createPattern(
"javax.ejb.S*",
IJavaSearchConstants.TYPE,
IJavaSearchConstants.ALL_OCCURRENCES,
SearchPattern.R_EXACT_MATCH
)
```
I do get the expected annotation matches (and also the import statements). Also, exact matches with queries like `javax.ejb.Stateless` do work.
Is this a limitation of the language server, or a bug? I know that annotation matches are returned as part of their annotated elements. I would expect that search to work normally.
Contributor guide
Research direction
Start by reproducing the two SearchPattern.createPattern cases in the issue, comparing R_PATTERN_MATCH with R_EXACT_MATCH for annotation usages and imports. Trace the search path that handles annotation matches and verify that wildcard queries return usages as well as imports. Done means the javax.ejb* pattern finds the expected annotation usages without regressing exact matches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100