Skip to content

Unwanted dependencies via rewrite-static-analysis #648

Closed

Description

@BoykoAlex

The size of the Spring Boot Language Server JAR has increased quite a bit in the past 6 months. Looks like major contributor to the size of the Boot LS JAR are the OpenRewrite libs.
There are libs such as rewrite-csharp, rewrite-kotlin, rewrite-github-actions, rewrite-jenkins. For example rewrite-csharp is unrelated to Spring at all yet it is still pulled in via the rewrite-static-analysis dependency.

Excluding these dependencies leads to Class Def Not Found Exceptions in rewrite-static-analysis from KotlinFileChecker and similar as well as from rewrite-migrate-java org.openrewrite.java.migrate.UpgradeJavaVersion where a class from rewrite-jenkins is used explicitly.

I'd propose to have runtime dependencies rather than compile for:

rewrite-spring -> rewrite-static-analysis. Only needs org.openrewrite.staticanalysis.RemoveUnneededBlock recipe for rewrite-static-analysis. I'd move this recipe in rewrite-java.

rewrite-migrate-java -> rewrite-static-analysis. Attempt to move recipes used from rewrite-static-analysis to rewrite-java as well. Some may move in rewrite-migrate-java such as ReplaceDeprecatedRuntimeExecMethods

rewrite-migrate-java -> rewrite-jenkins. Not sure how to convert this into the runtime dependency but would be nice as well.

The benefit of a runtime dependency would be that composite yaml recipe would miss a recipe rather than fail to load the entire composite recipe. Perhaps there is something else can be done with optional dependencies on Kotlin and C# libs such that recipes in rewrite-static-analysis won't throw exceptions. Please feel free to propose alternative ideas.

Activity

  1. added
    bug
    on Dec 11, 2024
  2. timtebeek commented on Dec 13, 2024

    @timtebeek
    Member

    hi @BoykoAlex ! Thanks for the initial work into figuring out how we can trim these dependencies down a bit; would indeed be nice to have these be a little more opt in as opposed to ever growing, but we'd also need to re-architect things a bit. For now: know that you've kicked off an internal discussion as well, as we reevaluate and make changes to make this optional.

  3. moved this to Backlog in OpenRewriteon Dec 13, 2024
  4. moved this from Backlog to Done in OpenRewriteon Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions