Skip to content

Conversation

@yashdoshi
Copy link

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.

@CLAassistant
Copy link

CLAassistant commented Oct 18, 2025

CLA assistant check
All committers have signed the CLA.

@yashdoshi yashdoshi force-pushed the fix-primitive-type-mapping branch 2 times, most recently from 1752e12 to 67e3ec3 Compare October 18, 2025 05:00
@yashdoshi
Copy link
Author

@dstepanov Looks good to you?

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
@yashdoshi yashdoshi force-pushed the fix-primitive-type-mapping branch from d2c24f1 to f360152 Compare October 24, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants