Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom class loaders to load Languagetool dependencies #2248

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

Auriga2
Copy link
Collaborator

@Auriga2 Auriga2 commented Dec 17, 2024

Prerequisites

  • Reviewed the checklist

  • Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
    for the "CI / Unit Tests") to complete first. Failed Unit tests can be
    debugged by adding the label "verbose logging" to the GitHub PR.

Description of the Change

Custom class loaders are now used to load Languagetool dependencies, to avoid indriya version conflicts.

languagetool requires indriya v1.3 or earlier while systems-common used by gt-opengis is not compatible with 1.3 and requires a later version. (v2.0.2 or latest v2.2) This caused #2054

All other approaches I've tried, like ivy configs, Maven Shade Plugin and Relocation, only works for build-time conflicts. In our scenario we need to isolate 2 versions of the same library at runtime. Using a Custom ClassLoader seems to be the only possibility.

I used ivy configs to isolate the languagetool libs into a separate folder, rather than listing all the transient dependencies of languagetool in the code. The latter could cause version conflicts, as Ivy might resolve to different versions than those we have hard-coded. On the other hand ivy configs duplicates the common transient libraries.

I am loading only the Languagetool dependencies separately, keeping the rest of the constellation intact, to avoid too much complications, and when the Languagetool developers fix their issue we can easily revert the changes. (Usually both versions of the dependency is loaded using custom class loaders)

Know issues:
Undo after Ignore all doesn't work (Pre-existed)

To Do:
Find a way to reuse the common transient libraries.

Alternate Designs

  • Fix the bug in org.languagetool
  • Use a different spell check library

Why Should This Be In Core?

Enables spell checking in enabled text fields

Benefits

Possible Drawbacks

Complex coding

Verification Process

  • Spell checking works (in Data access view)
  • Schema view loads without any exception
  • Export to GeoPackage and Export to ShapeFile works

Applicable Issues

#870

Auriga2 added 30 commits March 29, 2023 18:00
…s context menu, auto complete etc. and make the UI similar to the javafx TextArea
…ng, workaround to fix the slowness in initial spellcheck etc.
# Conflicts:
#	CorePluginFramework/src/au/gov/asd/tac/constellation/plugins/parameters/PluginParameter.java
# Conflicts:
#	CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/plugins/experimental/TestParametersPlugin.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.form
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.java
#	CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt
# Conflicts:
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.form
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanelController.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/Bundle.properties
#	CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt
…l and main app

* add a message explaining the error or when no suggestions available
# Conflicts:
#	CoreDependencies/nbproject/project.xml
#	CoreDependencies/src/ivy.xml
#	CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt
Auriga2 added 3 commits May 2, 2024 08:17
# Conflicts:
#	CorePluginFramework/src/au/gov/asd/tac/constellation/plugins/gui/PluginParametersPane.java
#	CorePluginFramework/src/au/gov/asd/tac/constellation/plugins/gui/ValueInputPane.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.form
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.java
# Conflicts:
#	CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/plugins/experimental/TestParametersPlugin.java
#	CoreDependencies/src/ivy.xml
#	CorePluginFramework/src/au/gov/asd/tac/constellation/plugins/gui/PasswordInputPane.java
#	CorePluginFramework/src/au/gov/asd/tac/constellation/plugins/gui/ValueInputPane.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.form
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/ApplicationOptionsPanel.java
#	CorePreferences/src/au/gov/asd/tac/constellation/preferences/Bundle.properties
#	CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt
# Conflicts:
#	CoreWhatsNewView/src/au/gov/asd/tac/constellation/views/whatsnew/whatsnew.txt
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
11.9% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants