lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <>
Subject Caveat when upgrading from 4.0.0-ALPHA to 4.0.0-BETA (CharStream overrides).
Date Fri, 17 Aug 2012 20:15:08 GMT
I've just hit this and I thought I'd share -- don't know if this was
discussed. I had to update some code from 4.0.0-ALPHA to 4.0.0-BETA.
We have custom subclasses of CharFilter.

In ALPHA, CharFilter extends from (indirectly) Reader. In BETA, it
inherits from FilteredReader. The (surprising?) difference is that for
alpha it was enough to override reader's only abstract method, namely:

abstract public int read(char cbuf[], int off, int len) throws IOException;

because all the other methods redirect to this one (this isn't a
contract but they do). When one switches to beta and makes all the
tiny code tweaks the code stops working correctly because all the
read() methods from FilterReaderdelegate directly to the wrapped
reader and not to FilterReader's read(char[],int,int).

It could be corrected by overriding those methods in CharFilter... but
then, maybe it would be enough to put a big red javadoc warning from
those who are upgrading (like me)?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message