Repository navigation
Conversation
Reject ordinary field and property names with a suffix check before inspecting Kotlin data-class metadata. Preserve the existing regex match for candidate delegate names and cover both paths with regression tests and a cold-fork benchmark. Closes spring-projects#3567 Signed-off-by: Greg Taube <gregjotau@gmail.com>
Contributor
Author
|
@mp911de would be great to have this one for 4.2.0 spring boot :) We are already using the RC1 spring boot and benefit from the recently added performance improvements 🚀 FYI. this is just me asking gpt-6.1 sol: And then after the analysis: That was literally my prompt. |
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.
Ordinary fields and properties currently trigger
KotlinReflectionUtils.isDataClasseven though their names cannot match the delegate-field pattern. Reject names without a$delegatesuffix before inspecting Kotlin metadata. Candidate delegate names still pass through the existing data-class and regex checks, preserving their matching behavior.Includes regression tests for both overloads and a JMH cold-start benchmark using the existing
SimpleDataClassfixture. On upstream main677c139, JDK 27 and the default Kotlin 2.4.21, ten fresh JVM forks withSingleShotTime, no warmup and-prof gcgave:This measures the filter's first use, including reflection initialization it triggers. Other application components can initialize the same metadata, so these figures are not a whole-application speedup claim. A separate Kotlin 2.5.0-Beta2 reproduction also improves with cold and cached metadata.
Validation:
./mvnw testpasses (3,899 tests, zero failures/errors, 13 skipped). Eight fresh extracted Spring Boot application startups pass health, login-render and public API document checks. A separate instrumented startup recorded 4,019 calls toisDataClassfrom the filter across 328 declaring classes before the change and zero afterwards. Shared-host load prevents a reliable end-to-end timing claim../mvnw -Pjmh -DskipTests test-compilealso passes.Closes #3567.