Annotations with target TYPE_USE are missing from JavaField instances
Maintainers usually reply within 1 day
@StefanGraeber is already working on this.
Since Aug 30, 2026.
Assessment
This issue has not been assessed yet.
Description
Hi,
While working on some ArchUnit checks (I find the tool really useful so far!), I found that annotations with a target of @Target(TYPE_USE) are ignored (for example with @Nullable from Jspecify).
To reproduce, I created my own annotation:
@Target({TYPE_USE})
@Retention(RUNTIME)
public @interface Foo {}
Inspecting an ArchUnit JavaField resulting from importing a class with a field annotated with this annotation, no JavaAnnotations are present.
When adding or using FIELD as target, the JavaAnnotation is present on the JavaField instance.
@Target({TYPE_USE, FIELD})
@Retention(RUNTIME)
public @interface Foo {}
It would be great if these annotations were imported!
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 350
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TNG/ArchUnit
-
PackageMatcher wildcards don't match package names with non-ASCII lettersPossibly taken @StefanPenndorf claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
beFreeOfCycles() misses cycles: TarjanComponentFinder does not return the component with the lowest node indexPossibly taken @StefanPenndorf claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
Constructor parameters added by the compiler (inner classes, enums) make `getParameters()` / `getParameterTypes()` inconsistent and misplace parameter annotationsPossibly taken @SamuelAdigos claimed this 2 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
breaking change
Difficulty 5/5 Over a week Newbie friendliness 18/100
TNG/ArchUnit#1756 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
IdentityArrayObjectSet iterator remove may throw ArrayIndexOutOfBoundsExceptionPossibly taken @jiteshkhatri11 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
javapathfinder/jpf-core#660 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
breaking change bug needs human review not ready priority medium size S
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
martin-francois/symphony-trello#1193 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day