Skip to content

#1382 initialize componentType of array classes in constructor - #1739

Open
StefanGraeber wants to merge 1 commit into
mainfrom
feature/1382_eager_array_component_type
Open

StefanGraeber wants to merge 1 commit into
mainfrom
feature/1382_eager_array_component_type

Conversation

@StefanGraeber

Copy link
Copy Markdown
Contributor

Till now, JavaClass representing an array type returned true for isArray but empty for getComponentType between creating the JavaClass and completing it. This gap breaks the construction of annotated types as soon as any array type reference exists (inclduing synthetic $VALUES field in enum). To prepare AnnotatedArrayType, the componentType is now resolved before constructing the JavaClass. This is always possible because array classes are always stubs.

Till now, JavaClass representing an array type returned true for isArray but empty for getComponentType between creating the JavaClass and completing it.
This gap breaks the construction of annotated types as soon as any array type reference exists (inclduing synthetic $VALUES field in enum).
To prepare AnnotatedArrayType, the componentType is now resolved before constructing the JavaClass.
This is always possible because array classes are always stubs.

Signed-off-by: Stefan Gräber <stefan.graeber@tngtech.com>
@StefanGraeber
StefanGraeber force-pushed the feature/1382_eager_array_component_type branch from afd150d to 0d96175 Compare October 5, 2026 07:29

@schulzjo-tng schulzjo-tng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Leaving it up to you if you want to add another test.

}

@Test
public void finds_array_type_multi_dimensional_and_recursive() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this test is good to have, it actually passes on the current main branch. Are you able to test the change in behaviour now, or does that require further features to be developed?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants