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

primitive vs wrapper objects abiguity inside the container [SPR-5881] #10550

Closed
spring-projects-issues opened this issue Jun 29, 2009 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jun 29, 2009

Costin Leau opened SPR-5881 and commented

The container could be more explicit about its treatment of primitive vs wrapper objects. Consider the following example:

Foo(Boolean bool)
Foo(boolean bool)

and the configuration

<bean class="Foo">
    <constructor-arg>
         <value type="boolean">true</value>
    </constructor-arg>
</bean>

The Boolean constructor is called instead of the primitive one since the primitives are always wrapped at runtime. Considering the red-herring that primitives are, it would be saner to actually get an exception as the case is ambiguous - both constructor apply and it's unclear who should be used.
The work-around for people that depend on this behaviour is to specify a clear type on the constructor arg:

<constructor-arg value="java.lang.Boolean">....

Affects: 3.0 M3

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 16, 2009

Juergen Hoeller commented

This should be solved along with #10486, as far as my unit tests indicate...

Juergen

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: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants