Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jsonp-dev] UnsupportedOperationExceptions in weird places

I'm trying to write an implementation of the API and am finding that
the API throws UnsupportedOperationExceptions in places I wouldn't
expect them, but doesn't in places that I would.

For example, JsonArrayBuilder has tons of operations that, by default,
throw UnsupportedOperationExceptions, but seem like they're fairly
straightforward to implement. Because they have a default
implementation, my IDE doesn't mark them as necessary to implement the
interface, so it's very easy to miss them and end up with an
UnsupportedOperationException where I didn't mean to have one.

In contrast, JsonArray implements List, but is immutable. It seems
like it would make complete sense to add default implementation for
all of the mutative List operations so that people don't accidentally
implement them when they shouldn't.

Is there a method to this that I'm not seeing or are things just in a
weird in-between state at the moment?

Todd


Back to the top