Mark Wielaard wrote:

> Do newer versions of javadoc really no longer mention wether a method is
> synchronized? That would be not good.

This seems obvious for me. In other case people would actually look at 
javadoc modifiers to see if method is synchronized, instead of checking 
the description (only place where it can be written).

Compare two methods

public synchronized int hashCode()
{
    int hash = 0;
    for ( int i =0; i < size; i++ )
        hash ^= array[i];
    return hash;
}


public int hashCode()
{
    int hash = 0;
    synchronized(this)
    {
       for ( int i =0; i < size; i++ )
        hash ^= array[i];
    }
    return hash;
}


Do they differ enough to make difference in javadoc ?


This example if of course trivial, but sometimes computations which can 
be done safely outside synchronization block can be quite expensive. Do 
you want to take away possibility to optimize it by enforcing people to 
stick to synchronizing entire method, because it is done such in spec ? 
Instead of synchronizing only parts which are really needed ?

I was surprised that they EVER documented it in javadoc - but it was 
probably thinko from early days and only when they wanted to modify 
something they started to think again.

Artur


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to