This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gui] Boolean and formatting fix


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]