javanna commented on code in PR #16755:
URL: https://github.com/apache/lucene/pull/16755#discussion_r4167541004
##########
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:
nit: do we need a new unmodifiable wrapper at every call of this method, or
can we reuse the same every time?
--
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]