[gui] Boolean and formatting fix
Jerry Quinn
jlquinn@optonline.net
Fri Oct 29 03:11:00 GMT 2004
Michael Koch wrote:
> Am Donnerstag, 28. Oktober 2004 16:58 schrieb Tom Tromey:
>
>>>>>>>"Michael" == Michael Koch <konqueror@gmx.de> writes:
>>
>>Michael> Are you sure this is correct ? boolean.class is not the
>>same as Michael> Boolean.class.
>>
>>He's still passing boolean.class to getConstructor. For the actual
>>newInstance call, boolean values must be wrapped in Boolean, he
>>just changed the code from `new Boolean' to `Boolean.valueOf'.
>
>
> I saw this. I just wondered if the code is correct at all. I don't
> knew that reflection transforms java.lang.Boolean arguments
> automatically to boolean.
The getConstructor call doesn't have any comments about mapping Boolean.class
to boolean args, so I used boolean.class. However, when calling newInstance,
you do have to wrap a boolean in a Boolean. The sun docs never really talk
about how ambiguity between boolean and Boolean are called.
BTW, I just checked and boolean.class is the right thing to use in
getConstructor according sun java.
Jerry
More information about the Java-patches
mailing list