tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [OT] of the different methods to get a user-id
Date Mon, 16 Feb 2009 21:10:17 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 2/12/2009 10:27 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net]
>> Subject: Re: [OT] of the different methods to get a user-id
>>
>> I don't understand that, either. I suppose this works differently in
>> different languages, though:
>>
>> return i++;
>>
>> return (i++);
> 
> Not any that I'm aware of; the value of the i++ expression is the same, regardless of
the number of parentheses you wrap it in.

But sometimes the value is surprising.

For instance.

i = i++

yields different results depending on what language you are using. C and
Java produce different outputs (which really surprised me!).

>> What I also don't understand is why userPrincipal is used directly
>> instead of this.getUserPrincipal, which would allow some measure of
>> extensibility of the class.
> 
> Since the userPrincipal field is protected, not private, the subclass
> can just use it to store its Principal object, so I don't see a real
> problem.

I'm not saying it's not legal, I'm just saying it's not extensible. If a
superclass wants to override getUserPrincipal for some reason, the
subclass doesn't benefit (or doesn't work, in certain situations). Thsi
is one of the reasons I hate using protected members: members become
part of the interface, which is ... weird.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmZ1jkACgkQ9CaO5/Lv0PAu7ACeKb+mqxYgZbHC8VDd+PRQAsvZ
B4MAnRYVo2/2eMA5ILWXGWvZik/2lJDo
=5EcI
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message