Since the upgrade to jackrabbit 2.2 (REPOSITORY-142), the NodeIterator.getSize() call is much more unreliable. If the NodeIterator comes from a result of a JCR query, the result is -1, unless a result order has been specified in the query.
Therefore, the result of AmetysObjectIterable.getSize() can't be trusted, as it delegates to NodeIterator.getSize() when the iterable is backed by a NodeIterator (for instance, when calling AmetysObjectResolver.query()).
AmetysObjectIterable.getSize() should be avoided when a reliable result is wanted.
Most of all, it's often called to know if there are results in the iterable (getSize() == 0, getSize() > 0). Those tests should be replaced by calls to hasNext(), which returns always a valid result.