<Swing Dev> GapContent behaviour

Roman Kennke roman at kennke.org
Thu Sep 27 19:01:03 UTC 2007


while implementing GapContent back then in GNU Classpath, I noticed that
the JDK implementation does not exactly conform to the specs in
AbstractDocument.Content. There, all the methods are specified to throw
a BadLocationException for invalid locations. However, the GapContent
doesn't throw an exception there. For example, it is possible to create
a Position for a location that is outside the GapContent object.

I'm not sure if I'm mis-interpreting the specification here. It could be
argued that it means, the implementation MAY throw an exception in such
a case, but doesn't HAVE TO. OTOH, not doing so in the reference
implementation might lead application implementors to rely on less
strict behaviour which can easily break on different implementations.

What do you think?

BTW, we observed a number of other places where the spec and the
behaviour diverged in Swing. David, do you recall some of these? I think
you even filed bug reports about some, right?

Cheers, Roman

More information about the swing-dev mailing list