You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mk...@apache.org on 2020/12/15 05:56:41 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9021: re-use the LookaheadSuccess exception in Lucene QueryParser

This is an automated email from the ASF dual-hosted git repository.

mkhl pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 11d5461f LUCENE-9021: re-use the LookaheadSuccess exception in Lucene QueryParser
11d5461f is described below

commit 11d5461f99df08fd6f5042dee5c269832febda48
Author: Przemek Bruski <pr...@gmail.com>
AuthorDate: Tue Dec 15 06:56:21 2020 +0100

    LUCENE-9021: re-use the LookaheadSuccess exception in Lucene QueryParser
    
    Co-authored-by: Przemek Bruski <pb...@atlassian.com>
---
 lucene/CHANGES.txt                                                   | 2 ++
 lucene/queryparser/build.xml                                         | 5 +++++
 .../src/java/org/apache/lucene/queryparser/classic/QueryParser.java  | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9f346d7..0d7406c 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -38,6 +38,8 @@ Optimizations
 
 * LUCENE-9536: Reduced memory usage for OrdinalMap when a segment has all
   values. (Julie Tibshirani via Adrien Grand)
+  
+* LUCENE-9021: QueryParser: re-use the LookaheadSuccess exception. (Przemek Bruski via Mikhail Khludnev)
 
 * LUCENE-9636: Faster decoding of postings for some numbers of bits per value.
   (Guo Feng via Adrien Grand)
diff --git a/lucene/queryparser/build.xml b/lucene/queryparser/build.xml
index b6e43c2..330720b 100644
--- a/lucene/queryparser/build.xml
+++ b/lucene/queryparser/build.xml
@@ -74,6 +74,11 @@
          byline="true"
          match="public QueryParser\(QueryParserTokenManager "
          replace="protected QueryParser(QueryParserTokenManager "/>
+      <!-- change an exception used for signaling to be static -->
+      <replaceregexp file="src/java/org/apache/lucene/queryparser/classic/QueryParser.java"
+         byline="true"
+         match="final private LookaheadSuccess jj_ls ="
+         replace="static final private LookaheadSuccess jj_ls =" />
       <generalReplaces dir="src/java/org/apache/lucene/queryparser/classic"/>
     </sequential>
   </target>
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java
index 134ddfa..e8110d9 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java
@@ -814,7 +814,7 @@ public class QueryParser extends QueryParserBase implements QueryParserConstants
   }
 
   static private final class LookaheadSuccess extends java.lang.Error { }
-  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+  static final private LookaheadSuccess jj_ls = new LookaheadSuccess();
   private boolean jj_scan_token(int kind) {
     if (jj_scanpos == jj_lastpos) {
       jj_la--;