Skip to content

Conversation

ppkarwasz
Copy link
Contributor

@ppkarwasz ppkarwasz commented Jul 1, 2025

This update fixes the GraalVM reachability metadata generation for methods with annotated array parameters, such as @Nullable String[].

Previously, the code computed the fully qualified class name for the parameter using the raw type, which retained the annotations (e.g., @org.jspecify.annotations.Nullable java.lang.String). This resulted in incorrect metadata that was ignored by GraalVM.

The issue is resolved by transforming the DeclaredType into a TypeElement, effectively removing any annotations, and then calling getQualifiedName() to correctly generate the fully qualified class name without annotations.

Closes #3796

This update fixes the GraalVM reachability metadata generation for methods with annotated array parameters, such as `@Nullable String[]`.

Previously, the code computed the fully qualified class name for the parameter using the **raw** type, which retained the annotations (e.g., `@org.jspecify.annotations.Nullable java.lang.String`). This resulted in incorrect metadata that was ignored by GraalVM.

The issue is resolved by transforming the `DeclaredType` into a `TypeElement`, effectively removing any annotations, and then calling `getQualifiedName()` to correctly generate the fully qualified class name without annotations.
When compiling with JDK 8 an "unknown enum constant java.lang.annotation.ElementType.MODULE" warning appears.
@ppkarwasz ppkarwasz enabled auto-merge (squash) July 3, 2025 14:07
@ppkarwasz ppkarwasz merged commit 7da8450 into 2.x Jul 3, 2025
7 checks passed
@ppkarwasz ppkarwasz deleted the fix/2.x/3796_annotated-array-parameters branch July 3, 2025 14:55
@github-project-automation github-project-automation bot moved this from To triage to Done in Log4j bug tracker Jul 3, 2025
ppkarwasz added a commit that referenced this pull request Jul 5, 2025
This update fixes the GraalVM reachability metadata generation for methods with annotated array parameters, such as `@Nullable String[]`.

Previously, the code computed the fully qualified class name for the parameter using the **raw** type, which retained the annotations (e.g., `@org.jspecify.annotations.Nullable java.lang.String`). This resulted in incorrect metadata that was ignored by GraalVM.

The issue is resolved by transforming the `DeclaredType` into a `TypeElement`, effectively removing any annotations, and then calling `getQualifiedName()` to correctly generate the fully qualified class name without annotations.
vy pushed a commit to ashr123/logging-log4j2 that referenced this pull request Jul 20, 2025
This update fixes the GraalVM reachability metadata generation for methods with annotated array parameters, such as `@Nullable String[]`.

Previously, the code computed the fully qualified class name for the parameter using the **raw** type, which retained the annotations (e.g., `@org.jspecify.annotations.Nullable java.lang.String`). This resulted in incorrect metadata that was ignored by GraalVM.

The issue is resolved by transforming the `DeclaredType` into a `TypeElement`, effectively removing any annotations, and then calling `getQualifiedName()` to correctly generate the fully qualified class name without annotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Invalid Java type for annotated array parameters

2 participants