Adding values to enum java.net.StandardProtocolFamily

Florian Weimer fweimer at redhat.com
Thu Feb 13 05:33:16 PST 2014


On 02/13/2014 02:21 PM, Alan Bateman wrote:
> On 13/02/2014 12:54, Florian Weimer wrote:
>> Can we add further enumeration values to
>> java.net.StandardProtocolFamily?  The spec does not say so, unlike
>> javax.lang.model.SourceVersion, and the code in the JDK expects a
>> binary flag, so I think the answer is "no".
>>
>> Does this mean the expected way to add support for further protocol
>> families would be to create a separate implementation of
>> java.net.ProtocolFamily?

> If there are protocol families that will be part of Java SE and
> supported in all implementations then they could be added
> StandardProtocolFamily. On the other hand, if this is platform or JDK
> implementation specific then implementing ProtocolFamily is the way to
> go (the enum extending interface pattern is something that we've used in
> other areas too).

Okay, sounds reasonable.  The PF_LOCAL protocol family is not available 
with Winsock, so I guess it will have to be a separate enum then, with a 
single member, although OpenJDK already requires PF_LOCAL support on the 
non-Windows platforms.

-- 
Florian Weimer / Red Hat Product Security Team


More information about the net-dev mailing list