avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen McConnell <mcconn...@apache.org>
Subject Re: [VOTE] LogKit LoggerListener API
Date Thu, 06 Feb 2003 20:10:02 GMT


Leo Sutic wrote:

>  
>
>>From: Berin Loritsch [mailto:bloritsch@apache.org] 
>>
>>void addLoggerListener( final LoggerListener listener )
>>     throws java.util.TooManyListenersException()
>>{
>>     if ( null == m_loggerListener )
>>     {
>>         m_loggerListener = listener;
>>     }
>>     else
>>     {
>>         throw new java.util.TooManyListenersException();
>>     }
>>}
>>    
>>
>
> +1
>
>  
>
>>* Easy to do, does not change functionality
>>* Clearer contract, although it forces client code to do exception
>>   handling for the listener.
>>* No future API changes other than the removal of the declared
>>    
>>
>exception
>
>Will result in compilation errors. Given a:
>
>try {
>   x.addLoggerListener (this);
>} catch (TooManyListenersException tmle) {
>   // Do nothing
>}
>
>if addLoggerListener (this) doesn't throw a TooManyListenersException,
>javac will complain that "TooManyListenersException not thrown in
>corresponding try clause".
>

But the proposed implementation DOES declare and can potentially throw a 
TooManyListenersException.  I don't get the issue here.  I must be 
missing something (seems to be a habbit lately) - please explain.

Cheers, Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




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


Mime
View raw message