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

Restrict or remove usages of add-classpath! #113

Closed
vemv opened this issue Apr 11, 2021 · 5 comments · Fixed by #114
Closed

Restrict or remove usages of add-classpath! #113

vemv opened this issue Apr 11, 2021 · 5 comments · Fixed by #114
Labels
enhancement Improvement to an existing feature

Comments

@vemv
Copy link
Member

vemv commented Apr 11, 2021

Context

There's a number of issues indicating that the use of orchard.java/add-classpath! creates issues that end users can experience:

#112
#103
#105

Some time has passed since those were reported (especially for clojure-emacs/cider-nrepl#668 - more than a year) so it seems a good idea to take action.

Proposal

Any of these would seem sensible:

  • Make features/dependencies that ultimately use dynapath/add-classpath! opt-out
    • Pro: no changes needed for current consumers, wanting to use related features
    • Con: introduces the need to convey to users that they likely want to set this property
    • Con: by default, the same currently-buggy behavior would arise.
  • Make features/dependencies that ultimately use dynapath/add-classpath! opt-in
    • Pro: bug-free experience by default
  • Remove dynapath/add-classpath! entirely.
    • Pro: bug-free experience by default
    • Con: perhaps an excessively dramatic measure, that would make Git history more churn-y, assuming that in a later moment a fix is found for these issues.
      • Can also invite clients to create their own solutions, which is kind of an anti-goal for Orchard, per its README

How

For the two first alternatives:

Other considerations

It's worth reminding that add-classpath! has essentially (afaict) two big use cases:

  • making sources and javadocs available
  • adding dependencies in runtime

For the former, that is a problem to which I happen to have found a robust solution, free of classloader intricacies. See clojure-emacs/cider-nrepl#64 (comment)

This is to say, for 50% of the use cases there's a real alternative that can be used today. The other 50% is not unimportant, but likely it doesn't justify introducing buggy behavior that can affect unrelated 3rd-party libraries.

@bbatsov
Copy link
Member

bbatsov commented Apr 11, 2021

It's worth reminding that add-classpath! has essentially (afaict) two big use cases:

Indeed. And we don't really use this for adding depedencies at runtime, so you can argue we've got just one use-case in practice. On top of this - it seems our use case causes problems for many people, as you've already noted, that's why I'm leaning more and more towards:

  1. Moving the classpath modification stuff to cider-nrepl, where in theory it should be simpler as at least you can operate directly on the session classloaders
  2. Removing this completely if you manage to extend your Lein plugin approach to the JDK's own sources and JavaDocs.

Can also invite clients to create their own solutions, which is kind of an anti-goal for Orchard, per its README

Yeah, that's true - but if our solution doesn't work I guess we're still inviting them to do something else. ;-) There's also the part about Orchard aiming to have 0 runtime deps and dynapath being the only one. In a way, that's not a big deal, as it's unlikely that the user apps depend on dynapath, but I'd still love to get to a self-contained library at some point.

@bbatsov
Copy link
Member

bbatsov commented Apr 11, 2021

Some time has passed since those were reported (especially for clojure-emacs/cider-nrepl#668 - more than a year) so it seems a good idea to take action.

Yeah, that's regrettable, but it's also a reflection for how little time we've all been able to dedicate to Orchard and related libraries recently. :-( This doesn't change the fact that it's probably one of the most important problems to address, given how many people are affected by it.

@bbatsov bbatsov added the enhancement Improvement to an existing feature label Apr 11, 2021
@vemv
Copy link
Member Author

vemv commented Apr 11, 2021

Thanks for the thoughts!

SGTM. I can provide a PR removing dynapath entirely, if that helps.

Also good to hear that the Lein plugin approach would be welcome as well. I was waiting to see how theseclojure-emacs issues would develop before implementing further features (JDK sources, tools.deps compat).

They are a stone's throw away so it's safe to assume they'll be available in a couple weeks :)

@bbatsov
Copy link
Member

bbatsov commented Apr 11, 2021 via email

@vemv
Copy link
Member Author

vemv commented Apr 11, 2021

👍 Perfect! Doing

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

Successfully merging a pull request may close this issue.

2 participants