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

GenericTypeResolver does not resolve the correct parameter type when bound type is also ParameterizedType [SPR-10819] #15445

Closed
spring-issuemaster opened this issue Aug 9, 2013 · 2 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Aug 9, 2013

Teddy Zhu opened SPR-10819 and commented

Follow is test code snap.

import org.springframework.core.GenericTypeResolver;

public class TestGeneric {

public static void main(String[] args) {
	Class[] types = GenericTypeResolver.resolveTypeArguments(Test.class, ITest.class);
	for (Class klass : types) {
		
		System.out.println(klass);//Issue: suppose should print B at least, but it print Object
	}
}

}

class A{}

class B<T>{}

class ITest<T>{}

class Test<I extends A, T extends B<I>> extends ITest<T>{

}


Affects: 3.1.3

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 9, 2013

Teddy Zhu commented

It should print B at least if we don't know the concrete type , but it print Object.
But if I change the
class Test<I extends A, T extends B<I>> extends ITest<T>{
}
to
class Test<I extends A, T extends B> extends ITest<T>{
}
then, the test will print the B. It cause some issue when I use spring-data-mongodb.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 20, 2013

Juergen Hoeller commented

Good catch! Fixed for 4.0 RC1 now, and backported to 3.2.5.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.