You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2023/05/16 11:09:36 UTC

[lucene] branch main updated: remove max recursion from Operations.java to AutomatonTestUtil.java (#12298)

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

rmuir pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new f53eb28af05 remove max recursion from Operations.java to AutomatonTestUtil.java (#12298)
f53eb28af05 is described below

commit f53eb28af053d7612f7e4d1b2de05d33dc410645
Author: tang donghai <ta...@gmail.com>
AuthorDate: Tue May 16 19:09:28 2023 +0800

    remove max recursion from Operations.java to AutomatonTestUtil.java (#12298)
    
    Co-authored-by: tangdonghai <ta...@meituan.com>
---
 .../core/src/java/org/apache/lucene/util/automaton/Operations.java   | 3 ---
 .../org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java    | 5 ++++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
index b3c10cebfa0..8448dfc8795 100644
--- a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
+++ b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
@@ -61,9 +61,6 @@ public final class Operations {
    */
   public static final int DEFAULT_DETERMINIZE_WORK_LIMIT = 10000;
 
-  /** Maximum level of recursion allowed in recursive operations. */
-  public static final int MAX_RECURSION_LEVEL = 1000;
-
   private Operations() {}
 
   /**
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java
index 0a64252387d..38819479cfc 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java
@@ -46,6 +46,9 @@ public class AutomatonTestUtil {
   /** Default maximum number of states that {@link Operations#determinize} should create. */
   public static final int DEFAULT_MAX_DETERMINIZED_STATES = 1000000;
 
+  /** Maximum level of recursion allowed in recursive operations. */
+  public static final int MAX_RECURSION_LEVEL = 1000;
+
   /** Returns random string, including full unicode range. */
   public static String randomRegexp(Random r) {
     while (true) {
@@ -483,7 +486,7 @@ public class AutomatonTestUtil {
   // large automata could exceed java's stack so the maximum level of recursion is bounded to 1000
   private static boolean isFinite(
       Transition scratch, Automaton a, int state, BitSet path, BitSet visited, int level) {
-    if (level > Operations.MAX_RECURSION_LEVEL) {
+    if (level > MAX_RECURSION_LEVEL) {
       throw new IllegalArgumentException("input automaton is too large: " + level);
     }
     path.set(state);