-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix BeanIntrospection to handle primitive types in property lookup #12142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yashdoshi
wants to merge
6
commits into
micronaut-projects:4.10.x
Choose a base branch
from
yashdoshi:fix-primitive-type-mapping
base: 4.10.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix BeanIntrospection to handle primitive types in property lookup #12142
yashdoshi
wants to merge
6
commits into
micronaut-projects:4.10.x
from
yashdoshi:fix-primitive-type-mapping
+170
−3
Conversation
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
1752e12 to
67e3ec3
Compare
dstepanov
requested changes
Oct 18, 2025
core/src/main/java/io/micronaut/core/beans/BeanIntrospection.java
Outdated
Show resolved
Hide resolved
|
@dstepanov Looks good to you? |
dstepanov
approved these changes
Oct 22, 2025
Fixes micronaut-projects#12079 - Added helper methods isAssignableFrom() and getWrapperType() to properly handle primitive-to-wrapper type conversion - Updated getProperty(), getReadProperty(), and getWriteProperty() methods to use the new helper - Primitive types are now converted to their wrapper equivalents before assignability checking - Resolves IntrospectionException when using Micronaut Mapper with primitive types All existing mapper tests pass with no regressions.
- Added PrimitiveMapperSpec.groovy using Spock Framework instead of JUnit - Added PrimitiveTypes.java with test classes for primitive type mapping - Tests cover both primitive-to-wrapper and wrapper-to-primitive mapping - Follows existing codebase patterns with documentation tags - Validates the fix for primitive type mapping in BeanIntrospection
- Removed // tag::primitive-beans[] and // end::primitive-beans[] tags - Removed // tag::primitive-mapper[] and // end::primitive-mapper[] tags - These tags are only needed for files included in documentation generation - PrimitiveTypes.java is a test utility file, not part of the documentation
- Removed // tag::primitive[] and // end::primitive[] tags - This is a test file, not part of the documentation - Documentation tags should only be used for files included in docs generation
- Replace isAssignableFrom method calls with direct inline usage - Remove redundant isPrimitive() check since ReflectionUtils.getWrapperType() handles it - Simplify code by eliminating unnecessary helper method - Maintains same functionality with cleaner, more direct implementation
- Use ReflectionUtils.getWrapperType() directly in type checking - Remove redundant primitive checks and helper methods - Cleaner, more efficient implementation
d2c24f1 to
f360152
Compare
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 IntrospectionException when using Micronaut Mapper with primitive types. Adds helper methods to convert primitive types to wrapper types before assignability checking. All tests pass with no regressions.