|
47 | 47 | (atom nil))
|
48 | 48 |
|
49 | 49 | (def ^:private parser-next-source-info
|
50 |
| - (delay |
51 |
| - (when (>= misc/java-api-version 11) |
52 |
| - (try (let [f (requiring-resolve 'orchard.java.parser-next/source-info)] |
53 |
| - ;; We try parsing LruMap.java as a litmus test for whether the |
54 |
| - ;; parser works. We can be sure that LruMap.java is on the |
55 |
| - ;; classpath because we pack it into the final Orchard jar. |
56 |
| - (when (f `LruMap) |
57 |
| - f)) |
58 |
| - (catch Throwable e |
59 |
| - (reset! parser-exception e) |
60 |
| - nil))))) |
| 50 | + (when (>= misc/java-api-version 11) |
| 51 | + (requiring-resolve 'orchard.java.parser-next/source-info))) |
61 | 52 |
|
62 | 53 | (defn source-info
|
63 | 54 | "Try to return class info from its parsed source if the source is available.
|
64 | 55 | Returns nil in case of any errors."
|
65 | 56 | ([class-symbol]
|
66 | 57 | ;; Arity for backward compatibility.
|
67 |
| - (try |
68 |
| - (let [klass (resolve class-symbol) |
69 |
| - url (some-> klass src-files/class->source-file-url)] |
70 |
| - (when url |
71 |
| - (source-info klass url))) |
72 |
| - (catch Throwable e |
73 |
| - (reset! parser-exception e) |
74 |
| - (when (= (System/getProperty "orchard.internal.test-suite-running") "true") |
75 |
| - (throw e))))) |
| 58 | + (when parser-next-source-info |
| 59 | + (parser-next-source-info class-symbol))) |
76 | 60 | ([klass source-url]
|
77 |
| - (try |
78 |
| - (when-let [f @parser-next-source-info] |
79 |
| - (f klass source-url)) |
80 |
| - (catch Throwable e |
81 |
| - (reset! parser-exception e) |
82 |
| - (when (= (System/getProperty "orchard.internal.test-suite-running") "true") |
83 |
| - (throw e)))))) |
| 61 | + (when parser-next-source-info |
| 62 | + (parser-next-source-info klass source-url)))) |
84 | 63 |
|
85 | 64 | ;; As of Java 11, Javadoc URLs begin with the module name.
|
86 | 65 | (defn module-name
|
|
285 | 264 | :file-url source-file-url
|
286 | 265 | :resource relative-source-path})
|
287 | 266 | (when (and *analyze-sources* source-file-url)
|
288 |
| - (source-info c source-file-url)) |
| 267 | + (try (source-info c source-file-url) |
| 268 | + (catch Exception _))) |
289 | 269 | {:name (-> c .getSimpleName symbol)
|
290 | 270 | :class (-> c .getName symbol)
|
291 | 271 | :package package
|
|
0 commit comments