eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Unused private field is not marked as unused if it's annotated

Open
#1,156 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

Relevant issues:
* https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1052
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=547451#c24

If ECJ is configured to warn about unused fields, it does not do so if the field is annotated (at least for some annotations).

For example, using Lombok:

```java
class My {
@NonFinal // https://projectlombok.org/api/lombok/experimental/NonFinal
private int resultDebt;
}
```
the field is not marked as unused even though it should be.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the ECJ unused-field warning with the annotated Lombok @NonFinal example and trace the compiler's unused-field analysis. The fix is done when annotated fields that are never used are reported appropriately, while the relevant annotation behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
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.