[
https://issues.apache.org/jira/browse/TINKERPOP-1498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15565793#comment-15565793
]
Daniel Kuppitz commented on TINKERPOP-1498:
-------------------------------------------
With these changes:
{code}
public final class BulkSet<S> extends AbstractSet<S> implements Set<S>,
Serializable {
private final Map<S, Long> map;
public BulkSet() {
this(new LinkedHashMap<>());
}
private BulkSet(final Map<S, Long> map) {
this.map = map;
}
...
public boolean add(final S s, final long bulk) {
final S item = Objects.equals(s, this) ? (S) new BulkSet<>(new
LinkedHashMap<>(map)) : s;
final Long current = this.map.get(s);
if (current != null) {
this.map.put(item, current + bulk);
return false;
} else {
this.map.put(item, bulk);
return true;
}
}
...
}
{code}
...I get:
{noformat}
gremlin> __.inject(1,2,3).choose(select("x").count(local).is(gt(0)),
select("x"), constant("x")).store("x")
==>x
==>{x=1, {x=1}=1}
==>{x=1, {x=1}=1, {x=1, {x=1}=1}=1}
{noformat}
Do we like that?
> choose() can throw StackOverflowErrors
> --------------------------------------
>
> Key: TINKERPOP-1498
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1498
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.2.2
> Reporter: Daniel Kuppitz
>
> {noformat}
> gremlin> g = TinkerFactory.createModern().traversal()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
> gremlin> g.V().choose(select("x"), select("x"), constant("not x")).store("x")
> java.lang.StackOverflowError
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)