Missing methods to override in GSet
While working on another Scala client, I wondered if, since a GSet is supposed to be grow-only, we shouldn't also override the following methods so they throw an UnsupportedOperationException like remove does? Am I missing something?
Methods are:
def removeAll(c: util.Collection[_]): Booleandef removeIf(filter: Predicate[_ >: T]): Booleandef clear(): Unitdef retainAll(c: util.Collection[_]): Boolean
Proposed solution:
Add the java equivalent of the following code to io.cloudstate.javasupport.crdt.GSet
override def removeAll(c: util.Collection[_]): Boolean =
throw new UnsupportedOperationException(
"Remove is not supported on a Grow-only Set.")
override def removeIf(filter: Predicate[_ >: T]): Boolean =
throw new UnsupportedOperationException(
"Remove is not supported on a Grow-only Set.")
override def clear(): Unit =
throw new UnsupportedOperationException(
"Remove is not supported on a Grow-only Set.")
override def retainAll(c: util.Collection[_]): Boolean =
throw new UnsupportedOperationException(
"Remove is not supported on a Grow-only Set.")
@ChristopherAndre Doesn't the default implementations of all those methods call remove at some point? Could you show me what happens if you invoke any of them?
@ChristopherAndre Ping
Sorry, completely slipped off my mind...
I think you're right but am not sure implementations have to call remove.
@ChristopherAndre No worries. What happens if you try to call the methods?