Skip to content

Commit b98dfbc

Browse files
committed
Initial offering
1 parent a22e916 commit b98dfbc

File tree

8 files changed

+768
-0
lines changed

8 files changed

+768
-0
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Setup Java
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: '21'
17+
18+
- name: Install CLI
19+
run: |
20+
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/posix-install.sh
21+
chmod +x posix-install.sh
22+
sudo ./posix-install.sh
23+
clojure
24+
25+
- name: Run tests
26+
run: clojure -M:test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.cpcache

LICENSE

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
e, and distribute the
2+
Work and such Derivative Works in Source or Object form.
3+
4+
3.prominent notices
5+
stating that You changed the files; and
6+
7+
(c) You must retain, in the Source form of any Derivative Works
8+
within a NOTICE text file distributed
9+
as part of the Derivative Works; within the Source form or
10+
documentation, if provided along with the Derivative Works; or,
11+
withless for any liability
12+
incurred by, or claims asserted against, such Contributor by reason
13+
of your accepting any such warranty or additional liability.
14+
15+
END OF TERMS AND CONDITIONS
16+
17+
APPENDIX: How to apply the Apache License to your work.
18+
19+
To apply the Apache License to your work, attach the following
20+
boilerplate notice, with the fields enclosed by brackets "[]"
21+
replaced with your own identifying information. (Don't include
22+
the brackets!) The text should be enclosed in the appropriate
23+
comment syntax for the file format. We also recommend that a
24+
file or class name and description of purpose be included on the
25+
same "printed page" as the copyright notice for easier
26+
identification within third-party archives.
27+
28+
Copyright [yyyy] [name of copyright owner]
29+
30+
Licensed under the Apache License, Version 2.0 (the "License");
31+
you may not use this file except in compliance with the License.
32+
You may obtain a copy of the License at
33+
34+
http://www.apache.org/licenses/LICENSE-2.0
35+
36+
Unless required by applicable law or agreed to in writing, software
37+
distributed under the License is distributed on an "AS IS" BASIS,
38+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39+
See the License for the specific language governing permissions and
40+
limitations under the License.A
41+
PARTICULAR PURPOSE. You are solely responsible for determining the
42+
appropriateness of using or redistributing the Work and assume any
43+
risks associated with Your exercise of permissions under this License.
44+
45+
8. Limitation of Liability. In no event and under no legal theory,
46+
whether in tort (including negligence), contract, or otherwise,
47+
unless required by applicable law (such as deliberate and grossly
48+
negligent acts) or agreed to in writing, shall any Contributor be
49+
liable to You for damages, including any direct, indirect, special,
50+
incidental, or consequential damages of any character arising as a
51+
result of this License or out of the use or inability to use the
52+
Work (including but not limited to damages for loss of goodwill,
53+
work stoppage, computer failure or malfunction, or any and all
54+
other commercial damages or losses), even if such Contributor
55+
has been advised of the possibility of such damages.
56+
57+
9. Accepting Warranty or Additional Liability. While redistributing
58+
the Work or Derivative Works thereof, You may choose to offer,
59+
and charge a fee for, acceptance of support, warranty, indemnity,
60+
or other liability obligations and/or rights consistent with this
61+
License. However, in accepting such obligations, You may act only
62+
on Your own behalf and on Your sole responsibility, not on behalf
63+
of any other Contributor, and only if You agree to indemnify,
64+
defend, and hold each Contributor harmr modifications and
65+
may provide additional or different license terms and conditions
66+
for use, reproduction, or distribution of Your modifications, or
67+
for any such Derivative Works as a whole, provided Your use,
68+
reproduction, and distribution of the Work otherwise complies with
69+
the conditions stated in this License.
70+
71+
5. Submission of Contributions. Unless You explicitly state otherwise,
72+
any Contribution intentionally submitted for inclusion in the Work
73+
by You to the Licensor shall be under the terms and conditions of
74+
this License, without any additional terms or conditions.
75+
Notwithstanding the above, nothing herein shall supersede or modify
76+
the terms of any separate license agreement you may have executed
77+
with Licensor regarding such Contributions.
78+
79+
6. Trademarks. This License does not grant permission to use the trade
80+
names, trademarks, service marks, or product names of the Licensor,
81+
except as required for reasonable and customary use in describing the
82+
origin of the Work and reproducing the content of the NOTICE file.
83+
84+
7. Disclaimer of Warranty. Unless required by applicable law or
85+
agreed to in writing, Licensor provides the Work (and each
86+
Contributor provides its Contributions) on an "AS IS" BASIS,
87+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
88+
implied, including, without limitation, any warranties or conditions
89+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR in a display generated by the Derivative Works, if and
90+
wherever such third-party notices normally appear. The contents
91+
of the NOTICE file are for informational purposes only and
92+
do not modify the License. You may add Your own attribution
93+
notices within Derivative Works that You distribute, alongside
94+
or as an addendum to the NOTICE text from the Work, provided
95+
that such additional attribution notices cannot be construed
96+
as modifying the License.
97+
98+
You may add Your own copyright statement to You that You distribute, all copyright, patent, trademark, and
99+
attribution notices from the Source form of the Work,
100+
excluding those notices that do not pertain to any part of
101+
the Derivative Works; and
102+
103+
(d) If the Work includes a "NOTICE" text file as part of its
104+
distribution, then any Derivative Works that You distribute must
105+
include a readable copy of the attribution notices contained
106+
within such NOTICE file, excluding those notices that do not
107+
pertain to any part of the Derivative Works, in at least one
108+
of the following places: Grant of Patent License. Subject to the terms and conditions of
109+
this License, each Contributor hereby grants to You a perpetual,
110+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
111+
(except as stated in this section) patent license to make, have made,
112+
use, offer to sell, sell, import, and otherwise transfer the Work,
113+
where such license applies only to those patent claims licensable
114+
by such Contributor that are necessarily infringed by their
115+
Contribution(s) alone or by combination of their Contribution(s)
116+
with the Work to which such Contribution(s) was submitted. If You
117+
institute patent litigation against any entity (including a
118+
cross-claim or counterclaim in a lawsuit) alleging that the Work
119+
or a Contribution incorporated within the Work constitutes direct
120+
or contributory patent infringement, then any patent licenses
121+
granted to You under this License for that Work shall terminate
122+
as of the date such litigation is filed.
123+
124+
4. Redistribution. You may reproduce and distribute copies of the
125+
Work or Derivative Works thereof in any medium, with or without
126+
modifications, and in Source or Object form, provided that You
127+
meet the following conditions:
128+
129+
(a) You must give any other recipients of the Work or
130+
Derivative Works a copy of this License; and
131+
132+
(b) You must cause any modified files to carry n,
133+
and conversions to other media types.
134+
135+
"Work" shall mean the work of authorship, whether in Source or
136+
Object form, made available under the License, as indicated by a
137+
copyright notice that is included in or attached to the work
138+
(an example is provided in the Appendix below).
139+
140+
"Derivative Works" shall mean any work, whether in Source or Object
141+
form, that is based on (or derived from) the Work and for which the
142+
editorial revisions, annotations, elaborations, or other modifications
143+
represent, as a whole, an original work of authorship. For the purposes
144+
of this License, Derivative Works shall not include works that remain
145+
separable from, or merely link (or bind by name) to the interfaces of,
146+
the Work and Derivative Works thereof.
147+
148+
"Contribution" shall mean any work of authorship, including
149+
the original version of the Work and any modifications or additions
150+
to that Work or Derivative Works thereof, that is intentionally
151+
submitted to Licensor for inclusion in the Work by the copyright owner
152+
or by an individual or Legal Entity authorized to submit on behalf of
153+
the copyright owner. For the purposes of this definition, "submitted"
154+
means any form of electronic, verbal, or written communication sent
155+
to the Licensor or its representatives, including but not limited to
156+
communication on electronic mailing lists, source code control systems,
157+
and issue tracking systems that are managed by, or on behalf of, the
158+
Licensor for the purpose of discussing and improving the Work, but
159+
excluding communication that is conspicuously marked or otherwise
160+
designated in writing by the copyright owner as "Not a Contribution."
161+
162+
"Contributor" shall mean Licensor and any individual or Legal Entity
163+
on behalf of whom a Contribution has been received by Licensor and
164+
subsequently incorporated within the Work.
165+
166+
2. Grant of Copyright License. Subject to the terms and conditions of
167+
this License, each Contributor hereby grants to You a perpetual,
168+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
169+
copyright license to reproduce, prepare Derivative Works of,
170+
publicly display, publicly perform, sublicens
171+
Apache License
172+
Version 2.0, January 2004
173+
http://www.apache.org/licenses/
174+
175+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
176+
177+
1. Definitions.
178+
179+
"License" shall mean the terms and conditions for use, reproduction,
180+
and distribution as defined by Sections 1 through 9 of this document.
181+
182+
"Licensor" shall mean the copyright owner or entity authorized by
183+
the copyright owner that is granting the License.
184+
185+
"Legal Entity" shall mean the union of the acting entity and all
186+
other entities that control, are controlled by, or are under common
187+
control with that entity. For the purposes of this definition,
188+
"control" means (i) the power, direct or indirect, to cause the
189+
direction or management of such entity, whether by contract or
190+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
191+
outstanding shares, or (iii) beneficial ownership of such entity.
192+
193+
"You" (or "Your") shall mean an individual or Legal Entity
194+
exercising permissions granted by this License.
195+
196+
"Source" form shall mean the preferred form for making modifications,
197+
including but not limited to software source code, documentation
198+
source, and configuration files.
199+
200+
"Object" form shall mean any form resulting from mechanical
201+
transformation or translation of a Source form, including but
202+
not limited to compiled object code, generated documentatio

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# java.javadocs
2+
3+
A Clojure library for accessing JDK javadocs in your REPL
4+
5+
## Installation
6+
7+
### deps.edn
8+
9+
```clojure
10+
{:deps {org.clojure/java.javadoc {:git/url "https://github.com/clojure/java.javadoc"
11+
:git/sha "abc123"}}}
12+
```
13+
14+
### In the REPL with add-libs
15+
16+
For usage without modifying your project deps:
17+
18+
```clojure
19+
;; This require is only necessary if not in user namespace
20+
(require '[clojure.repl.deps :refer [add-lib]])
21+
22+
(add-lib 'org.clojure/java.javadoc)
23+
24+
(require '[java-javadocs.core :refer [javadoc javadoc-data]])
25+
26+
;; Now you can use it
27+
(javadoc String)
28+
```
29+
30+
### From the Command Line
31+
32+
Invoke directly from the command line, useful for piping into a .md file to display in your editor:
33+
34+
```bash
35+
clojure -Sdeps '{:deps {org.clojure/java.javadoc {:git/url "https://github.com/clojure/java.javadoc" :git/sha "abc123"}}}' \
36+
-M -e "(require '[java-javadocs.core :refer [javadoc]]) (javadoc String)"
37+
```
38+
39+
## Usage
40+
41+
The core namespace provides two functions:
42+
43+
### javadoc
44+
45+
Prints a markdown formatted version of the javadoc description:
46+
47+
```clojure
48+
(require '[java-javadocs.core :refer [javadoc javadoc-data]])
49+
50+
;; Print class description
51+
(javadoc String)
52+
53+
;; Print all overloads of a method
54+
(javadoc String/valueOf)
55+
56+
;; Specify a specific overload using param-tags
57+
(javadoc ^[char/1] String/valueOf)
58+
59+
;; Use _ to match any type:
60+
(javadoc ^[_ int int] String/.substring)
61+
```
62+
63+
### javadoc-md
64+
65+
Returns structured data instead of printing:
66+
67+
```clojure
68+
(javadoc-data String)
69+
;; => {:classname "java.lang.String"
70+
;; :class-description-html "..."
71+
;; :class-description-md "..."
72+
;; :methods [{:signature "valueOf(int i)"
73+
;; :description "Returns the string representation..."
74+
;; :static? true
75+
;; :clojure-call "^[int] String/valueOf"}
76+
;; ...]}
77+
78+
(javadoc-data ^[char/1] String/valueOf)
79+
;; => {:classname "java.lang.String"
80+
;; :class-description-html "..."
81+
;; :class-description-md "..."
82+
;; :methods [...]
83+
;; :selected-method [{:signature "valueOf(char[] data)"
84+
;; :description "Returns the string representation..."
85+
;; :static? true
86+
;; :clojure-call "^[char/1] String/valueOf"
87+
;; :method-description-html "..."
88+
;; :method-description-md "..."}]}
89+
```
90+
91+
## Requirements
92+
93+
- Java 17+
94+
- Internet required to fetch html javadocs from docs.oracle.com
95+
96+
## Copyright and License
97+
98+
Copyright © 2025
99+
100+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
101+
102+
http://www.apache.org/licenses/LICENSE-2.0
103+
104+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

deps.edn

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{:paths ["src"]
2+
:deps {org.clojure/clojure {:mvn/version "1.12.3"}
3+
org.clojure/tools.deps {:mvn/version "0.20.1440"}
4+
com.vladsch.flexmark/flexmark-html2md-converter {:mvn/version "0.64.8"}
5+
org.jsoup/jsoup {:mvn/version "1.18.1"}}
6+
:aliases {:dev {:extra-paths ["test"]
7+
:extra-deps {nrepl/nrepl {:mvn/version "1.3.0"}
8+
cider/cider-nrepl {:mvn/version "0.50.2"}}
9+
:main-opts ["-m" "nrepl.cmdline"
10+
"--middleware" "[cider.nrepl/cider-middleware]"
11+
"--interactive"]}
12+
:test {:extra-paths ["test"]
13+
:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
14+
:main-opts ["-m" "cognitect.test-runner"]}
15+
:test-watch {:extra-paths ["test"]
16+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
17+
:main-opts ["-m" "kaocha.runner" "--watch"]}}}

0 commit comments

Comments
 (0)