Make static final Set immutable (#13055): EnumSet.of() returns a mutable Set that should not be used for static final constants.

# Conflicts:
#	lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanPartOfSpeechStopFilter.java
This commit is contained in:
Dmitry Cherniachenko 2024-01-30 11:53:42 +01:00 committed by Uwe Schindler
parent bb37626dbd
commit 1e36b46147
2 changed files with 23 additions and 19 deletions

View File

@ -43,6 +43,8 @@ Improvements
* GITHUB#13043: Support getMaxScore of ConjunctionScorer for non top level scoring clause. (Shintaro Murakami)
* GITHUB#13055: Make DEFAULT_STOP_TAGS in KoreanPartOfSpeechStopFilter immutable (Dmitry Cherniachenko)
Optimizations
---------------------

View File

@ -16,6 +16,7 @@
*/
package org.apache.lucene.analysis.ko;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import org.apache.lucene.analysis.FilteringTokenFilter;
@ -33,25 +34,26 @@ public final class KoreanPartOfSpeechStopFilter extends FilteringTokenFilter {
/** Default list of tags to filter. */
public static final Set<POS.Tag> DEFAULT_STOP_TAGS =
EnumSet.of(
POS.Tag.E,
POS.Tag.IC,
POS.Tag.J,
POS.Tag.MAG,
POS.Tag.MAJ,
POS.Tag.MM,
POS.Tag.SP,
POS.Tag.SSC,
POS.Tag.SSO,
POS.Tag.SC,
POS.Tag.SE,
POS.Tag.XPN,
POS.Tag.XSA,
POS.Tag.XSN,
POS.Tag.XSV,
POS.Tag.UNA,
POS.Tag.NA,
POS.Tag.VSV);
Collections.unmodifiableSet(
EnumSet.of(
POS.Tag.E,
POS.Tag.IC,
POS.Tag.J,
POS.Tag.MAG,
POS.Tag.MAJ,
POS.Tag.MM,
POS.Tag.SP,
POS.Tag.SSC,
POS.Tag.SSO,
POS.Tag.SC,
POS.Tag.SE,
POS.Tag.XPN,
POS.Tag.XSA,
POS.Tag.XSN,
POS.Tag.XSV,
POS.Tag.UNA,
POS.Tag.NA,
POS.Tag.VSV));
/**
* Create a new {@link KoreanPartOfSpeechStopFilter} with the default list of stop tags {@link