-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Inspector - misc #197
Inspector - misc #197
Conversation
d532636
to
6b934f1
Compare
So the inspector would no longer allow to descend into private fields? This is a huge usecase for the inspector, at least for me. |
With the advent of JDK 21 and the practical deprecation of JDK8 (CIDER will do it; I hear it that even Clojure may join that trend), I suspect that that demographic will abruptly change.
I'd understand that, otoh predictably sooner or later you'll use JDK17+ for the vast majority of your CIDER sessions. Note that with enrich-classpath, it's easier than ever to jump to a .java source so one can also learn about private fields in the source itself (and presumably java-mode or lsp-mode can help navigating a large .java file). I do sympathize with wanting features to stay, but sadly sometimes the world around us moves forward 🌀 |
I'm strongly against making changes that would negatively impact JDK 8 users, given how conservative Clojure devs often are. Until JDK 8 is supported by Clojure (and used by so many people as indicated by last survey), we should do our best to support it as well. |
Btw, are we sure there's no way to implement a similar behavior for newer JDKs? I'm kind of worried how many features disappear (e.g. evaluation can't be interrupted, private fields can't be accessed, etc) as things are changed in the JDK. |
Says who? |
(also - bigger changes of the breaking variety should probably have to wait until CIDER 2.0) |
I don't know of any other way but adding lots of Inability to interrupt threads is a big hit, yes. I tried looking into whether there are some leftovers for thread stopping in the JDK code that could be reenabled with an agent, for example, and couldn't find anything (but I didn't dig deep enough). |
Besides – nobody seems to be embracing module separation except for JDK itself. Third-party libraries all use the default unnamed module, so their private fields remain to be accessible. It's only the JDK's own modules that we aren't able to crack open. |
A middle ground surely is to keep trying to access fields, but hide the failed attempts. |
I don't mind. I made it show the failed attempts to signal to the user why a certain field is not shown. If you think it's too jarring, then fine. UPD: actually, I do mind, because the presence of a field is itself a useful piece of information. And being able to jump to the source isn't the same because: a) you need enrich-classpath which might not be always present; b) the source file can have a lot of javadocs and other cruft which makes quickly seeing which fields an object has quite difficult. c) if the class has parents, the inspector shows all fields at once while you have to navigate all parents through the source manually. UPD2: the inspector could be grouping the private inaccessible fields together in the end of the list so that they don't bother so much but still remain visible. |
Let's go for this one. I'll update the PR soon. btw, here's a toggler for .java source code (including docstrings) https://gist.github.com/vemv/7953ce6900fdf597e6199212752ecf32 |
…nspected All values are already formatted as strings, so this `pr-str` was redundant.
We got this as requested! Please check out the changelog for a detailed summary. This is how things are looking now: Objects
Classes
|
This looks gorgeous! Thanks for taking the time to resolve this in the best possible manner. |
Looks great indeed. Well done! |
Cheers 🙌 |
Those are conveyed by Orchard/cider-nrepl for representing values that cannot be inspected (i.e. private, inaccessible fields). See clojure-emacs/orchard#197 Fixes #3542
Those are conveyed by Orchard/cider-nrepl for representing values that cannot be inspected (i.e. private, inaccessible fields). See clojure-emacs/orchard#197 Fixes #3542
Hmm, I didn't mean to remove Should be an easy fix |
Thanks! ❤️ |
orchard.inspect
: don't usepr-str
over the mainValue:
being inspected.pr-str
was redundant.orchard.inspect
: render non-accessible fields better.<non-inspectable value>
for representing its value, clients being free to elide its rendering.Instance fields
,Static fields
,Private instance fields
,Private static fields
.Fields
section.orchard.inspect
: render field names as symbols, not strings.Cheers - V