Skip to content
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

Fix scanSuperTypes function to return Object Class instead of generic types #3150

Merged
merged 2 commits into from
Apr 28, 2024

Conversation

yuanjin5
Copy link
Contributor

Fix scanSuperTypes function to return Object Class instead of generic types

Unit Test Code

@Test
void testReturn_LV1Map() throws Exception {
   Class<?> clazz = Level1Mapper.class;
   Method method = clazz.getMethod("selectMap");
   Type result = TypeParameterResolver.resolveReturnType(method, clazz);
   assertTrue(result instanceof ParameterizedType);
   ParameterizedType paramType = (ParameterizedType) result;
   assertEquals(Map.class, paramType.getRawType());
   assertEquals(2, paramType.getActualTypeArguments().length);
   assertEquals(String.class, paramType.getActualTypeArguments()[0]);
   assertEquals(Object.class, paramType.getActualTypeArguments()[1]);
}

Expected :class java.lang.Object
Actual: F

@coveralls
Copy link

Coverage Status

coverage: 87.179% (+0.01%) from 87.168%
when pulling 8fb229e on yuanjin5:fixbug
into acc1086 on mybatis:master.

@harawata harawata self-assigned this Apr 28, 2024
@harawata harawata added the polishing Improve a implementation code or doc without change in current behavior/content label Apr 28, 2024
@harawata harawata modified the milestones: 3.5.16, 3.5.17 Apr 28, 2024
@harawata harawata merged commit 5bd8cb5 into mybatis:master Apr 28, 2024
19 checks passed
@harawata
Copy link
Member

Thank you, @yuanjin5 !

Although this is technically correct, it should not affect real projects. i.e. Level2Mapper#selectMap() should be used instead of Level1Mapper#selectMap().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polishing Improve a implementation code or doc without change in current behavior/content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants