-
-
Notifications
You must be signed in to change notification settings - Fork 53
Figure out what to do with our dynapath 1.0 compatibility problems #20
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
Comments
Maybe it's related, I've just checked Java 10 and got such warning. nRepl and Cider seem to work. nREPL server started on port 51299 on host 127.0.0.1 - nrepl://127.0.0.1:51299 |
Mirroring the boot approach seems difficult unless we control the start of the JVM very closely. I believe it needs to run prior to clojure. |
Unfortunately I'm out of other ideas. I'm guessing something must be possible, but I simply don't have the time to do the research for it. The fact that dynapath decided to drop this functionality instead of fixing it leads me to believe probably there's no easy solution, though. |
Inside of boot, I think we're okay, as we can use their compatible classloader. What features does dynapath provide to us? |
We use it only to add the JDK resources dynamically to the classpath, so afterwards things like source lookup and doc lookup will work for them. See Line 32 in 3934ea6
Unfortunately we're using exactly the damn method that the deprecation warnings are about. :-) |
I don't know how viable it is to use pomegranate but quick googling led me to this from a comment on clojuredocs |
Pomegranate uses dynapath, https://github.com/cemerick/pomegranate/blob/master/README.md#urlclassloader-modifiability
…On April 2, 2018 7:18:34 AM GMT+01:00, Xtreak ***@***.***> wrote:
> A re-implementation of add-classpath (deprecated in Clojure core)
that:
> is a little more comprehensive than core's add-classpath — it
should work as expected in more circumstances, and optionally uses
Maven-resolver to add a Maven artifact (and all of its transitive
dependencies) to your Clojure runtime's classpath dynamically.
I don't know how viable it is to use pomegranate but quick googling led
me to this from a
[comment](https://clojuredocs.org/clojure.core/add-classpath#example-59d7d6d8e4b03026fe14ea57)
on clojuredocs
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#20 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Pomegranate uses dynapath, it has the same problem.
But seems to have some solution.
https://github.com/cemerick/pomegranate/blob/master/README.md#urlclassloader-modifiability
…On April 2, 2018 7:18:34 AM GMT+01:00, Xtreak ***@***.***> wrote:
> A re-implementation of add-classpath (deprecated in Clojure core)
that:
> is a little more comprehensive than core's add-classpath — it
should work as expected in more circumstances, and optionally uses
Maven-resolver to add a Maven artifact (and all of its transitive
dependencies) to your Clojure runtime's classpath dynamically.
I don't know how viable it is to use pomegranate but quick googling led
me to this from a
[comment](https://clojuredocs.org/clojure.core/add-classpath#example-59d7d6d8e4b03026fe14ea57)
on clojuredocs
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#20 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
@SevereOverfl0w Not sure they have a real workaround.
This sounds like some flag to suppress the new behavior or something. And I don't see it in dynapath's readme. |
Why are we not under clojure.lang.DynamicClassLoader when running? |
No idea to be honest. I think @jeffvalk worked on this originally and we never had to change the code afterwards. Maybe he remembers something about this. |
For full Java source support, we need the JDK compiler classes in Dynapath was (at the time anyway...) the best option for loading these at runtime. And I believe dynapath does use a The use of dynapath wasn't very sophisticated; we just need to append those two resources to the classpath. |
@jeffvalk Looking at the code it seems it's URLClassLoader, unless I'm misunderstanding something. But I guess we need to change this now (and this would also mean we don't need dynapath anymore). |
I'm personally fine with the reflective warnings. are you sure java 10 is going to ban it completely? if cider can modify the ns macro https://github.com/clojure/clojure/blob/010864f8ed828f8d261807b7345f1a539c5b20df/src/clj/clojure/core.clj#L5553 to provide a alternate classloader with the additional urls, then it might work. |
Actually. I realised it's a slightly different problem (I was thinking in-editor evaluation), because Just write an alternate |
Hi, I'd like to summarize my understanding on this issue, and get some feedback from the maintainers if possible, especially to clear up any misconceptions :) This is what I understand from reading the code, and from @jeffvalk's comments:
Here are some minor problems posed by JDK version 9 and above:
Here are the more major problems with JDK 9 and above:
I'm actually hoping I'm wrong on that last point, otherwise I think it means we need to rewrite parser.clj just to support JDK 9 and above - there's a project called javaparser that might help, but it would mean bringing in a new dependency. I guess my question is does this sound like a good approach? is there a strong preference not to bring in new dependencies? The short-term approach here might just be to detect if JDK >= 9 and just not call |
Great summary, @jmingtan. This all sounds right to me at first read. Regarding the big problem:
The The other internal API classes currently imported (those in |
I had a quick go at this. I have a version of |
@jeffvalk Fantastic news! |
Thanks @jeffvalk! I had a go at implementing your suggestion too but I couldn’t figure out how to make the JavadocTool accept a zip file path, looking forward to seeing your implementation :) |
Update on this: The revised parser works fine with JDK9+ for all non-JDK Java sources. The sources to the JDK itself are tricky though -- partly due to the new Java module system, but mostly to a poor public API for the JDK compiler. The JDK sources are a primary use case; I'll continue to push on this to get it working. |
@jeffvalk How much more time do you think you'll need? I'm thinking of cutting a new cider-nrepl release over the new few days. |
@bbatsov It's hard to estimate -- getting the public compiler API to work with the modular JDK sources involves a lot of digging into compiler internals to figure out why different types of access errors occur. I'm sure there's a common thread (or a few), but it's not obvious (yet) and it's certainly not well-documented. What we could do in the meantime is release a version that works with most Java sources, but ignores the JDK sources under Java 9+. Then we can at least address the Dynapath dependency, which is what this issue was originally about. I'll try to give this a go in the next day. If I don't manage to get it done in the next 24 hours, it will likely be another week before I can push anything useful. (Holidays and such, you know -- which, btw, happy holidays!) |
I can live with this as a first step. :-)
Thanks! Happy Holidays to you as well! As for the release - it's not that big of a deal. If we have to wait a bit for it, I guess we'll wait. |
@bbatsov How far into the future do you envision Java 8 support? |
1-2 years at least, maybe more. It reaches its official EOL in December 2020. Given the massive changes in Java 9, I assume the migration from Java 8 is going to take quite a while for some organizations. |
Figured that was the case; makes sense. I'll write the 8 vs 9+ lib loading with that in mind. Must say, if other people's experience with Java modules is like what I've had trying to get the compiler API running, Java 8 may be around for longer than anyone wants... |
@jeffvalk When you click on a failed build there should be a button to re-run it. |
If there is one, it's not obvious where... |
Does it require a separate login to circleci? |
I can reproduce the JDK8 errors by ensuring |
Btw, won't this break the lookup of resources in Boot? I think the resources were on the fake classpath, but I don't use Boot, so I don't quite remember what were they doing exactly. |
Could be. I haven't checked the image myself - I just assumed Circle know what they are doing. :-) |
I'm hopeful. :-) Is there any way to check? Having |
The Boot logic seemed only to be appending |
BTW I don't have the dropdown menu you showed above in CircleCI. I presume it requires being logged in. |
I guess so. Btw, I see that on Java 11 there's some different problem:
Doesn't happen all the time, but it's probably something worth looking into. |
Yeah, this is the Heisenbug I was referring to. Happened for me on 18 of 1113 (1.6%) test runs. Not sure why it's more frequent on the CI server, but that's useful! This one appears to be a JDK bug in the Language Model API. I'll find a workaround. |
Workaround applied. The remaining CI build problems are related to this:
|
More likely a longer term thing... I'm sure better images exist, but nothing that's explicitly maintained for this purpose. Someone who's got good Dockerfile experience would be useful.. In the short term, we can probably just install |
This would be good. One quick note, if the images are Debian-based as your note suggests: The Debian packages install the JDK sources in a directory that's not a child of the JDK directory (e.g. |
FYI, I don't think this is debian specific but due to different java packaging guidelines? It seems (in linux world) java-8 is the last version with src.zip as child of JDK directory, otherwise within ./lib/
|
I have no insight here. If there's a specific guideline, I'd be interested in knowing what it is!
Orchard will find
|
Created #50 to track the CI configuration issue. |
@bbatsov A quick note as you're thinking about getting rid of the That code is easily replaced; Orchard doesn't do a lot of classloading (only |
I wasn't aware there was any protocol to go with dynapath - for some reason I thought it was just a mechanism for dynamically loading code.
In general I was thinking that maybe loading some extra resources should be done by the clients, not by Orchard itself (e.g. |
Moving runtime classloading to the clients is definitely possible. Orchard could just check the classpath to see if specific resources are present and act accordingly. |
Yep, exactly. |
This was linked from clojure-emacs/cider#2269 but it's unclear to me whether that issue is fixed or not. Is the javadoc & source code navigation supposed to work for JDK version > 8? |
Long story short:
We need to come up with some solution for this soon, otherwise it's going to cause problems for many people.
More details here clojure-emacs/cider-nrepl#482
The text was updated successfully, but these errors were encountered: