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

Inlined-deps orchard java cache is missing some information #687

Closed
nbardiuk opened this issue Jan 17, 2021 · 2 comments
Closed

Inlined-deps orchard java cache is missing some information #687

nbardiuk opened this issue Jan 17, 2021 · 2 comments

Comments

@nbardiuk
Copy link

I was debugging missing documentation for java symbols and reached discrepancy between orchard java cache and cache of inlined-deps orchard.

Expected behavior

@orcahrd.java/cache has the same information as
@cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java/cache

Actual behavior

@cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java/cache is missing some keys like
:doc and :arguments of :members

Steps to reproduce the problem

Leiningen with configured cider-nrepl and orchard 0.6.2 in depencies

(require '[orchard.java])
(require '[cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java])
(require '[clojure.data])

(->> [@orchard.java/cache
      @cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java/cache]

     (map #(-> % (get 'java.lang.Thread) :info :members (get 'sleep)))

     (apply clojure.data/diff))

Result:

({[long int] {:type void
              :column 5
              :line 324
              :argnames [millis nanos]
              :doc "Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors. @param millis the length of time to sleep in milliseconds @param nanos {@code 0-999999} additional nanoseconds to sleep @throws IllegalArgumentException if the value of {@code millis} is negative, or the value of {@code nanos} is not in the range {@code 0-999999} @throws InterruptedException if any thread has interrupted the current thread. The *interrupted status* of the current thread is cleared when this exception is thrown."}
  [long] {:type void
          :column 5
          :line 300
          :argnames [millis]
          :doc "Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors. @param millis the length of time to sleep in milliseconds @throws IllegalArgumentException if the value of {@code millis} is negative @throws InterruptedException if any thread has interrupted the current thread. The *interrupted status* of the current thread is cleared when this exception is thrown."}}
 nil
 {[long int] {:returns void
              :throws (java.lang.InterruptedException)
              :argtypes [long int]
              :modifiers #{:public :static}
              :name sleep}
  [long] {:returns void
          :throws (java.lang.InterruptedException)
          :argtypes [long]
          :modifiers #{:public :static :native}
          :name sleep}})

But after reseting the cache info method populates it with same metadata

;; reset cache
(reset! cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java/cache {})

;; resolve class info
(cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.info/info (symbol "user") (symbol "Thread/sleep"))

;; now both caches have the same info
(->> [@orchard.java/cache
      @cider.nrepl.inlined-deps.orchard.v0v6v2.orchard.java/cache]

     (map #(-> % (get 'java.lang.Thread) :info :members (get 'sleep)))

     (apply clojure.data/diff)
     (take 2))
;; => (nil nil)

Environment & Version information

cider-nrepl version

0.25.6

Java version

openjdk 11.0.9 2020-10-20

Operating system

Linux

@nbardiuk
Copy link
Author

nbardiuk commented Jan 17, 2021

clojure-emacs/orchard#103 - if inlined orchard cache is populated in different classloader than user interaction it would explain the issue

@jeffvalk
Copy link
Contributor

Yeah, that's exactly it. This is clojure-emacs/orchard#103.

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

No branches or pull requests

2 participants