Render object arrays as Kotlin Array<T> in querydsl-kotlin-codegen (#1790)#1791
Merged
velo merged 1 commit intoJun 9, 2026
Merged
Conversation
Object array properties (e.g. String[]) were emitted with Java array
syntax (ArrayPath<String[], String> = createArray("tags", String[]::class.java)),
which is not valid Kotlin and fails to compile. Map object arrays to the
Kotlin Array<T> type and the Array<T>::class.java class literal, while
keeping primitive arrays (int[], byte[], ...) on their dedicated Kotlin
array classes (IntArray, ByteArray, ...).
Fixes OpenFeign#1790
Signed-off-by: seonwoo_jung <79202163+seonwooj0810@users.noreply.github.com>
velo
approved these changes
Jun 9, 2026
velo
left a comment
Member
There was a problem hiding this comment.
Thanks for the focused fix. The production change has a compiling regression test, preserves existing primitive-array behavior and public API compatibility, and introduces no security risk. Required checks are green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1790
Problem
querydsl-kotlin-codegenemitted object-array properties (e.g.String[]) using Java array syntax, producing code that does not compile:String[]andString[]::class.javaare not valid Kotlin.Cause
In
Extensions.kt,Type.asClassName()special-cases the eight primitive array types (int[]→IntArray, etc.), but object arrays fall through to the genericClassName(packageName, simpleName)branch, where the array'ssimpleName(String[]) leaks into the generated source.asClassNameStatement()had the same gap.Fix
Map object arrays to the Kotlin
Array<T>type and theArray<T>::class.javaclass literal, while leaving primitive arrays on their dedicated Kotlin array classes (IntArray,ByteArray, …). Object arrays are detected viaType.getComponentType(), excluding the primitive-array full names thatasClassName()already handles. The same now generates:Tests
Added
EntitySerializerTest.object_array, taken from the reproducer in #1790, which asserts the generated declaration/statement and (via the existingassertCompileshelper) that the output compiles.Verification done: (1) no in-flight PR/linked branch for the array bug; (2) no active claim on the issue (only the boilerplate template checkbox); (3) fix touches
.ktfiles only; (4) confirmed the missing object-array case inasClassName/asClassNameStatementon currentmaster; (5) reproduced with the issue's test, which failed before and passes after; fullquerydsl-kotlin-codegentest suite green with no regressions.