Closed SteVio89 closed 3 days ago
This pull request introduces significant modifications across various classes in the LanguageTool project, primarily focusing on the instantiation of language classes using a singleton pattern. The changes affect how instances of GermanyGerman
and French
are created, replacing direct instantiation with calls to getInstance()
. This approach aims to enhance resource management and consistency. Additionally, various methods and tests have been updated to reflect these changes, ensuring that the new instantiation logic is uniformly applied throughout the codebase.
File Path | Change Summary |
---|---|
languagetool-core/src/main/java/org/languagetool/Languages.java |
Updated import statements; modified staticAndDynamicLanguages initialization; adjusted logic in getAllLanguages() to include "Premium" language classes; refined getLanguageForLocale() fallback logic. |
languagetool-dev/src/main/java/org/languagetool/dev/GenderWordFinder.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-dev/src/main/java/org/languagetool/dev/GermanOldSpellingFinder.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() in both main and main2 methods. |
languagetool-dev/src/main/java/org/languagetool/dev/MissingGermanCompoundAdjectiveFinder.java |
Updated instantiation of Tagger and GermanSpellerRule to use GermanyGerman.getInstance() . |
languagetool-dev/src/main/java/org/languagetool/dev/MissingGermanCompoundsFinder.java |
Changed instantiation of GermanSpellerRule to GermanyGerman.getInstance() . |
languagetool-dev/src/main/java/org/languagetool/dev/MissingGermanWords.java |
Updated instantiation of GermanSpellerRule to GermanyGerman.getInstance() . |
languagetool-dev/src/main/java/org/languagetool/dev/archive/GermanTaggerEnhancer.java |
Changed instantiation of Tagger to GermanyGerman.getInstance().getTagger() . |
languagetool-dev/src/main/java/org/languagetool/dev/archive/SimpleRuleCounter.java |
Updated method call from new GermanyGerman() to GermanyGerman.getInstance() . |
languagetool-dev/src/main/java/org/languagetool/dev/bigdata/GermanReflexiveVerbGuesser.java |
Changed instantiation of synthesizer to GermanyGerman.getInstance() . |
languagetool-dev/src/test/java/org/languagetool/dev/bigdata/CommonCrawlToNgramTest.java |
Updated instantiation of CommonCrawlToNgram to GermanyGerman.getInstance() . |
languagetool-language-modules/de-DE-x-simple-language/src/main/java/org/languagetool/language/SimpleGerman.java |
Changed instantiation of GermanRuleDisambiguator to getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/language/German.java |
Updated method calls to use GermanyGerman.getInstance() ; added new constant GERMAN_SHORT_CODE . |
languagetool-language-modules/de/src/main/java/org/languagetool/language/GermanyGerman.java |
Added getInstance() method; deprecated constructor. |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanCompoundRule.java |
Updated references from Languages.getLanguageForShortCode("de-DE") to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanNumberInWordFilter.java |
Changed instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanRepeatedWordsRule.java |
Updated instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/MissingCommaRelativeClauseRule.java |
Changed instantiation method for ANTI_PATTERNS to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/PotentialCompoundFilter.java |
Updated instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/ProhibitedCompoundRule.java |
Changed instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/RemoveUnknownCompoundsFilter.java |
Updated instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/ValidWordFilter.java |
Changed instantiation to GermanyGerman.getInstance() . |
languagetool-language-modules/de/src/test/java/org/languagetool/dev/bigdata/CommonCrawlToNgramTest.java |
Updated instantiation of CommonCrawlToNgram to GermanyGerman.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/language/BelgianFrench.java |
Added instantiationTrace field; updated constructor logic. |
languagetool-language-modules/fr/src/main/java/org/languagetool/language/CanadianFrench.java |
Added instantiationTrace field; updated constructor logic. |
languagetool-language-modules/fr/src/main/java/org/languagetool/language/French.java |
Added FRENCH_SHORT_CODE ; deprecated default constructor; added getInstance() method. |
languagetool-language-modules/fr/src/main/java/org/languagetool/language/SwissFrench.java |
Added instantiationTrace field; updated constructor logic. |
languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FindSuggestionsFilter.java |
Updated instantiation of MorfologikFrenchSpellerRule to French.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FrenchNumberInWordFilter.java |
Changed instantiation to French.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FrenchPartialPosTagFilter.java |
Updated instantiation to French.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FrenchRepeatedWordsRule.java |
Changed instantiation to French.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/InterrogativeVerbFilter.java |
Updated instantiation of morfologikRule to French.getInstance() . |
languagetool-language-modules/fr/src/main/java/org/languagetool/tagging/disambiguation/fr/FrenchHybridDisambiguator.java |
Changed instantiation of disambiguator to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/FrenchConcurrencyTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/JLanguageToolTest.java |
Changed instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/AnnotatedTextTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/GenericUnpairedBracketsRuleTest.java |
Changed instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/MorfologikFrenchSpellerRuleTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/QuestionWhitespaceRuleTest.java |
Changed instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/QuestionWhitespaceStrictRuleTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/SimpleReplaceRuleTest.java |
Changed instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/rules/spelling/hunspell/TestFrenchDisambiguator.java |
Updated instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/tagging/disambiguation/rules/fr/FrenchRuleDisambiguatorTest.java |
Changed instantiation of French to French.getInstance() . |
languagetool-language-modules/fr/src/test/java/org/languagetool/tagging/fr/FrenchTaggerTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-server/src/test/java/org/languagetool/server/HTTPSServerTest.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-server/src/test/java/org/languagetool/server/HTTPServerTest.java |
Updated instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-standalone/src/test/java/org/languagetool/JLanguageToolTest.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-standalone/src/test/java/org/languagetool/LanguageTest.java |
Updated equality checks to use GermanyGerman.getInstance() . |
languagetool-standalone/src/test/java/org/languagetool/dev/MultiThreadingTest2.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-standalone/src/test/java/org/languagetool/gui/ConfigurationTest.java |
Updated instantiation of French to French.getInstance() . |
languagetool-standalone/src/test/java/org/languagetool/rules/patterns/StartupTimePerformanceTest.java |
Updated instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-wikipedia/src/test/java/org/languagetool/dev/index/IndexerSearcherTest.java |
Changed instantiation of French to French.getInstance() and GermanyGerman to GermanyGerman.getInstance() . |
languagetool-wikipedia/src/test/java/org/languagetool/dev/wikipedia/SuggestionReplacerTest.java |
Updated instantiation of GermanyGerman to GermanyGerman.getInstance() . |
languagetool-wikipedia/src/test/java/org/languagetool/dev/wikipedia/WikipediaQuickCheckTest.java |
Changed instantiation of GermanyGerman to GermanyGerman.getInstance() . |
Languages
class and the handling of language instances are related to the optimizations made in the getSentenceWithImmunization
method of the Rule
class, which also focuses on improving performance in language processing tasks. Both PRs aim to enhance the efficiency of language handling within the LanguageTool framework.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Here is the next one https://github.com/languagetool-org/languagetool/pull/11064
Summary by CodeRabbit
New Features
GermanyGerman
andFrench
classes, improving resource management and consistency.Bug Fixes
Documentation
Chores