Re: Why are the header classes final?

"M. Rangnathan" <[email protected]>
Newsgroups gmane.comp.voip.nist-sip
Message-ID <[email protected]>
[email protected] wrote:

> On Thu, 9 Nov 2006 at 07:56, Jeroen van Bemmel wrote:
>
>> final helps improve performance, and it also helps us to detect when 
>> people
>
>
>> From everything I've read about this sounds like that is not true
>
> except in very restricted cases.
>
>> are trying to do things that they shouldn't (no offence). Trying to 
>> add a
>
>
> Um.  Don't I get to decide what I want to do?  I thought open source
> software was about freedom :) :)
>
> Seriously, though, I really don't understand why subclassing a header
> class is something I shouldn't do.  Can someone explain?
>
>> subclassed header to a message will possibly give 
>> ClassCastExceptions. It
>
>
> Is this something intrinsic to Java?  I'm used to python, where if I
> create a subclass, the subclass instances can be used anywhere the
> superclass could be unless the programmer works hard to make it
> otherwise.



 I was thinking .equals would fail but the .equals method uses the 
interface and not the Impl object so that would work. The Header 
Factory, however, will createHeader using the original class and not 
your class so you are going to need to change the HeaderFactory to use 
your new class.


 I think what you want to do is the following : rather than worry about 
the Header implementation classes (of which there are many), you may be 
better off making a special version of AddressImpl.java with the 
encode() method changed ( thats where the quote goes in).

I'd be hesitant to accept such a change into the cvs repository. The 
quotes should be there. Let us know how it goes. Asterisk is a good 
interoperability target. If it works, then perhaps a static flag can be 
added to AddressImpl that is defaulted to false. If you set the flag 
then the quotes are ommitted when encoding (this would be a NIST SIP 
only feature of course).

Ranga


>
>> would actually be better to make all header implementations final
>
>
> Rats.  That's the opposite of the answer I was hoping to hear. :(
>
> --David
> _______________________________________________
> nist-sip mailing list
> [email protected]
> http://www-x.antd.nist.gov/mailman/listinfo/nist-sip
>


-- 
M. Ranganathan 

Advanced Networking Technologies Division,
National Institute of Standards and Technology (NIST),
100 Bureau Drive, Stop 8920, Gaithersburg, MD 20899. 
tel:301 975 3664 , fax:301 590 0932 http://w3.antd.nist.gov/
Advanced Networking Technologies For the People!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.