Skip to content

Apache Lucene open-source search software

LUCENE-6497: Allow subclasses of FieldType to check frozen state

Ryan Ernst942ba0724893
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index df546944996..05e3b23842a 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -218,6 +218,9 @@ API Changes
* LUCENE-6466: Moved SpanQuery.getSpans() and .extractTerms() to SpanWeight
(Alan Woodward)
+* LUCENE-6497: Allow subclasses of FieldType to check frozen state
+ (Ryan Ernst)
+
Other
* LUCENE-6413: Test runner should report the number of suites completed/
diff --git a/lucene/core/src/java/org/apache/lucene/document/FieldType.java b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
index 6ca3a02214b..8728e5bae48 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FieldType.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
@@ -32,7 +32,7 @@ public class FieldType implements IndexableFieldType {
/** Data type of the numeric value
* @since 3.2
*/
- public static enum NumericType {
+ public enum NumericType {
/** 32-bit integer numeric type */
INT,
/** 64-bit long numeric type */
@@ -80,7 +80,11 @@ public class FieldType implements IndexableFieldType {
public FieldType() {
}
- private void checkIfFrozen() {
+ /**
+ * Throws an exception if this FieldType is frozen. Subclasses should
+ * call this within setters for additional state.
+ */
+ protected void checkIfFrozen() {
if (frozen) {
throw new IllegalStateException("this FieldType is already frozen and cannot be changed");
}