Skip to content

Throw a meaningful exception if a TypeReference does not use a fully qualified name #28213

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

Closed
sdeleuze opened this issue Mar 22, 2022 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@sdeleuze
Copy link
Contributor

TypeReference.of("int") fails because a dot is expected in the type name.

begin 0, end -1, length 3
java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 3
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4601)
	at java.base/java.lang.String.substring(String.java:2704)
	at org.springframework.aot.hint.SimpleTypeReference.createTypeReference(SimpleTypeReference.java:60)
	at org.springframework.aot.hint.SimpleTypeReference.of(SimpleTypeReference.java:48)
	at org.springframework.aot.hint.TypeReference.of(TypeReference.java:75)
@sdeleuze sdeleuze added the type: bug A general bug label Mar 22, 2022
@sdeleuze sdeleuze added this to the 6.0.0-M4 milestone Mar 22, 2022
@snicoll snicoll added the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 22, 2022
@snicoll
Copy link
Member

snicoll commented Mar 22, 2022

Ignoring the exception, this is the expected behaviour. Fully qualified name is expected as an input here so it should be TypeReference.of("java.lang.int").

@snicoll snicoll changed the title Fix TypeReference#of for primitive types Throw a meaningful exception if a TypeReference does not use a fully qualified name Mar 22, 2022
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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants