[ Osvaldo Pinali Doederlein ] [ Osvaldo Pinali Doederlein ] [concurrency-interest] need to use collection.sort w. CopyOnWriteArrayList but cant.....

Curt Cox ccox@tripos.com
Fri, 4 Jun 2004 09:34:23 -0500


Rather than a proliferation of interfaces, why not use meta-data
to further specify the characteristics of collections and iterators?

The collections FAQ indicates that in order to keep the API
surface area small, interfaces with optional methods were used,
rather than using many more tightly focused interfaces.
That philosophy should still apply.

If information about an object isn't strictly required in
order to use it, but could be taken advantage of by a
sophisticated client to enhance performance, then it seems
like meta-data to me.

While I'm sure it is far to late to see in Tiger, it would
make sense to use meta-data to provide information on the
concurrency and order characteristics of methods.  Such
information could be used by tools to help spot scalability
and concurrency problems at compile time.  I argue for this
strategy here, but the arguments are even more valid when
concurrency is added to the mix.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5028425

By the way, is there a standard meta-data tag for expressing that
an operation is not implemented?  If so, is there any tool
that spots methods that always throw UnsupportedOperationException
without declaring the appropriate meta-data?

- Curt