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

This commit is contained in:
Dmitry Cherniachenko 2024-01-30 11:53:42 +01:00 committed by GitHub
parent 6566e33ff1
commit 4f0bc4f35c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 31 deletions

View File

@ -204,6 +204,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,6 +34,7 @@ public final class KoreanPartOfSpeechStopFilter extends FilteringTokenFilter {
/** Default list of tags to filter. */
public static final Set<POS.Tag> DEFAULT_STOP_TAGS =
Collections.unmodifiableSet(
EnumSet.of(
POS.Tag.EP,
POS.Tag.EF,
@ -63,7 +65,7 @@ public final class KoreanPartOfSpeechStopFilter extends FilteringTokenFilter {
POS.Tag.XSV,
POS.Tag.UNA,
POS.Tag.NA,
POS.Tag.VSV);
POS.Tag.VSV));
/**
* Create a new {@link KoreanPartOfSpeechStopFilter} with the default list of stop tags {@link