avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <j...@socialchange.net.au>
Subject Type-safe Enum not so type-safe.
Date Sun, 12 Aug 2001 11:06:07 GMT
A question, mainly for Pete,

Enum and ValuedEnum both have public constructors:

public Enum( final String name );
public Enum( final String name, final Map map );
public ValuedEnum( final String name, final int value );
public ValuedEnum( final String name, final int value, final Map map );

Because they're public, any class can add more Enum items at any time,
so the Enum is not type-safe at all. Possibly a security hazard if
anyone was relying on subclasses' type-safety.

Since the only time they should ever be called is within a subclass,
would it be better to make them protected? This technically breaks
backwards-compatibility, but only where the class is being incorrectly



To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

View raw message