@Override
    protected boolean filter(final Traverser.Admin<S> traverser) {
        // the generic S is defined as Element but Property can also be used with HasStep so this seems to cause
        // problems with some jdk versions.
        if (traverser.get() instanceof Element)
            return HasContainer.testAll(traverser.get(), this.hasContainers);
        else if (traverser.get() instanceof Property)
            return HasContainer.testAll((Property) traverser.get(), this.hasContainers);
        else
            throw new IllegalStateException(String.format(
                    "Traverser to has() must be of type Property or Element, not %s",
                    traverser.get().getClass().getName()));
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasStep.java