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

Support for ResolvableType.getType().getTypeName() on Java 8 [SPR-16535] #21078

Closed
spring-projects-issues opened this issue Feb 26, 2018 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Dave Syer opened SPR-16535 and commented

Example test that fails:

assertThat(ResolvableType.forClassWithGenerics(Consumer.class, String.class)
		.getType().getTypeName()).isEqualTo(Consumer.class.getName());

I think it just passes the type name property to toString() and that isn't very helpful in this case.

It would be nice for the type name to be the same as the raw type (the same as if I have defined a class that implements Consumer<String> and printed the type name of its interfaces.


Affects: 4.3.14

Referenced from: commits 6663d0f, 901d48c

Backported to: 4.3.15

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I wasn't even aware of that getTypeName() method... seems to be new in Java 8, making Type more than just a marker interface.

I'll make sure to properly expose the type name there and also on toString(), consistent with the JDK's standard Type implementations.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've implemented the above for 5.0.5, aligning both getTypeName() and toString() with the common JDK types. For 4.3.15, I'll just backport the getTypeName() part (to be bound to Type.getTypeName() when running on Java 8), leaving toString() untouched (since we can't trigger nested getTypeName() calls there on JDKs <8).

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants