File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 49
49
(def ^:private parser-next-source-info
50
50
(delay
51
51
(when (>= misc/java-api-version 11 )
52
- (try (let [f (misc/require-and -resolve 'orchard.java.parser-next/source-info)]
52
+ (try (let [f (requiring -resolve 'orchard.java.parser-next/source-info)]
53
53
; ; We try parsing LruMap.java as a litmus test for whether the
54
54
; ; parser works. We can be sure that LruMap.java is on the
55
55
; ; classpath because we pack it into the final Orchard jar.
87
87
" On JDK11+, return module name from the class if present; otherwise return nil"
88
88
[class-or-sym]
89
89
(when (>= misc/java-api-version 11 )
90
- ((misc/require-and -resolve 'orchard.java.modules/module-name) class-or-sym)))
90
+ ((requiring -resolve 'orchard.java.modules/module-name) class-or-sym)))
91
91
92
92
(defn javadoc-url
93
93
" Return the relative `.html` javadoc path and member fragment."
Original file line number Diff line number Diff line change 137
137
[ns ]
138
138
(instance? clojure.lang.Namespace ns ))
139
139
140
- ; ; Drop this in favor of clojure.core/requiring-resolve at some point?
141
-
142
140
(defn require-and-resolve
143
- " Try to require the namespace and get a var for the symbol, return the var's
144
- value if successful, nil if not ."
141
+ " Like `clojure.core/requiring-resolve`, but doesn't throw exception if namespace
142
+ was not found or failed to load. Also, returns derefs the resolved var ."
145
143
{:added " 0.5" }
146
144
[sym]
147
- (try (require ( -> sym namespace symbol) )
145
+ (try (some -> sym requiring-resolve var-get )
148
146
(var-get (resolve sym))
149
147
(catch Exception _)))
150
148
Original file line number Diff line number Diff line change 17
17
18
18
(def source-info
19
19
(when jdk11+?
20
- (misc/require-and -resolve 'orchard.java.parser-next/source-info)))
20
+ (requiring -resolve 'orchard.java.parser-next/source-info)))
21
21
22
22
(def parse-java
23
23
(when jdk11+?
24
- (misc/require-and -resolve 'orchard.java.parser-next/parse-java)))
24
+ (requiring -resolve 'orchard.java.parser-next/parse-java)))
25
25
26
26
(when jdk11+?
27
27
(deftest parse-java-test
You can’t perform that action at this time.
0 commit comments