lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trejkaz (JIRA)" <>
Subject [jira] [Created] (LUCENE-5676) QueryNodeImpl is too mutable
Date Fri, 16 May 2014 11:19:12 GMT
Trejkaz created LUCENE-5676:

             Summary: QueryNodeImpl is too mutable
                 Key: LUCENE-5676
             Project: Lucene - Core
          Issue Type: Improvement
          Components: modules/queryparser
            Reporter: Trejkaz

We use query nodes both during parsing and as a method of building queries. Somehow a bug
has crept into our system where a QueryNode somehow gets mutated to have a parent when the
node we created didn't originally have a parent. Some processor in our pipeline treats nodes
differently based on the parent, which makes it a very hard to find bug.

It would be very helpful if there were a method like freeze() which would make the instance
immutable from thereon, something like the following:

private volatile boolean frozen;

public final boolean isFrozen() {
    return frozen;

protected void aboutToMakeChanges() {
    if (isFrozen()) {
        throw new IllegalStateException("This object is frozen");

public A freeze() {
    frozen = true;
    return this;

// ...

private void setParent(QueryNode parent) {
    // existing code

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message