[concurrency-interest] ReentrantReadWriteLock backport non-matching signature
holger at wizards.de
Sun Jul 9 12:51:01 EDT 2006
Dawid Kurzyniec wrote:
> Moran Avigdor wrote:
>> You can narrow the backport implementation to return ReadLock and
>> WriteLock respectively,
>> instead of returning the Lock interface. This will then have the same
>> signature as Java 5.0
> No, unfortunately, this won't compile under Java 1.4 due to
> "incompatible return types". The ability to narrow return types in
> subclasses and implementation classes was added alongside generics in
> Java 5.0.
Maybe I'm missing something but why does the u.c ReentrantReadWriteLock
return the static inner class instead of the Read/WriteLock interfaces in
the first place?
The incompatibility is a serious problem for everybody using
retrotranslator or -weaver, and will likely just force people to continue
using the backport. Considering the number of showstopper fixes in Mustang
that are not backported to 1.5.x for (IMHO) no good reason that might
actually be the best route for many projects.
More information about the Concurrency-interest