Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Annotations with target TYPE_USE are missing from JavaField instances

Open
#1,382 27 comments 8 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@StefanGraeber is already working on this.

Since Aug 30, 2026.

  • #1666 by @winfriedgerlach — open
  • #1739 by @StefanGraeber — open
  • #1744 by @StefanGraeber — open

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

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.

More from TNG/ArchUnit

All issues in TNG/ArchUnit

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.