reugn commented on code in PR #16755:
URL: https://github.com/apache/lucene/pull/16755#discussion_r4182153028
##########
lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/uk/UkrainianMorfologikAnalyzer.java:
##########
@@ -63,67 +63,67 @@ public final class UkrainianMorfologikAnalyzer extends
StopwordAnalyzerBase {
NORMALIZER_MAP = builder.build();
}
- /** Returns a lazy singleton with the default Ukrainian resources. */
- @SuppressWarnings("NonFinalStaticField")
- private static volatile DefaultResources defaultResources;
-
- private static DefaultResources getDefaultResources() {
- if (defaultResources == null) {
- synchronized (DefaultResources.class) {
- try {
- CharArraySet wordList;
- try (var is =
UkrainianMorfologikAnalyzer.class.getResourceAsStream("stopwords.txt")) {
- if (is == null) {
- throw new IOException("Could not locate the required stopwords
resource.");
- }
- wordList = WordlistLoader.getSnowballWordSet(is);
+ /** Returns the default stopword set for this analyzer */
+ public static CharArraySet getDefaultStopwords() {
+ return CharArraySet.unmodifiableSet(DefaultsHolder.DEFAULT_STOP_SET);
Review Comment:
Right, removed the wrapper. `WordlistLoader.getSnowballWordSet` already
returns an unmodifiable CharArraySet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]