Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ executors:
docker:
- image: clojure:temurin-21-lein-2.12.0-noble
<<: *defaults
jdk24:
jdk25:
docker:
- image: clojure:temurin-24-lein-2.12.0-noble
- image: clojure:temurin-25-lein-2.12.0-noble
<<: *defaults

# Runs a given set of steps, with some standard pre- and post-
Expand Down Expand Up @@ -81,7 +81,7 @@ commands:
- base-src-jdk11.zip
- base-src-jdk17.zip
- base-src-jdk21.zip
- base-src-jdk24.zip
- base-src-jdk25.zip
key: cache-<< parameters.cache_version >>-{{ checksum "/tmp/clojure_cache_seed" }}

setup-windows:
Expand All @@ -98,7 +98,7 @@ jobs:
clojure_version:
type: string
default: "1.12"
executor: jdk24
executor: jdk25
environment:
CLOJURE_VERSION: << parameters.clojure_version >>
TEST_PROFILES: "-user,-dev,+test,+cljs"
Expand Down Expand Up @@ -184,15 +184,15 @@ workflows:
matrix:
alias: "test"
parameters:
jdk_version: [jdk8, jdk11, jdk17, jdk21, jdk24]
jdk_version: [jdk8, jdk11, jdk17, jdk21, jdk25]
clojure_version: ["1.10", "1.11", "1.12"]
<<: *run_always
- test:
# Sanity check that we don't have a requirement for Clojurescript being on the classpath.
matrix:
alias: "test_no_extra_deps"
parameters:
jdk_version: [jdk24]
jdk_version: [jdk25]
clojure_version: ["1.12"]
command: ["test-no-extra-deps"]
<<: *run_always
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ base-src-jdk17.zip:
base-src-jdk21.zip:
bash .circleci/download-jdk-sources.sh https://github.com/adoptium/jdk21u/archive/refs/tags/jdk-21.0.7+5.zip jdk21 $@

base-src-jdk24.zip:
bash .circleci/download-jdk-sources.sh https://github.com/adoptium/jdk/archive/refs/tags/jdk-24+36.zip jdk24 $@
base-src-jdk25.zip:
bash .circleci/download-jdk-sources.sh https://github.com/adoptium/jdk/archive/refs/tags/jdk-25+36.zip jdk25 $@

copy-sources-to-jdk: base-src-$(JDK_SRC_VERSION).zip
mkdir -p $(JAVA_HOME)/lib && cp base-src-$(JDK_SRC_VERSION).zip $(JAVA_HOME)/lib/src.zip
Expand Down
10 changes: 5 additions & 5 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@

:javac-options ["-Xlint:unchecked"]

:profiles {:provided {:dependencies [[org.clojure/clojure "1.12.0"]
[org.clojure/clojure "1.12.0" :classifier "sources"]]}
:profiles {:provided {:dependencies [[org.clojure/clojure "1.12.3"]
[org.clojure/clojure "1.12.3" :classifier "sources"]]}

:1.10 {:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/clojure "1.10.3" :classifier "sources"]]}
:1.11 {:dependencies [[org.clojure/clojure "1.11.4"]
[org.clojure/clojure "1.11.4" :classifier "sources"]]}
:1.12 {:dependencies [[org.clojure/clojure "1.12.0"]
[org.clojure/clojure "1.12.0" :classifier "sources"]]}
:1.12 {:dependencies [[org.clojure/clojure "1.12.3"]
[org.clojure/clojure "1.12.3" :classifier "sources"]]}

;; Needed to test how Orchard behaves with Clojurescript on classpath.
:cljs {:dependencies [[org.clojure/clojurescript "1.11.132"]]
Expand All @@ -54,6 +54,6 @@
:cljfmt {:plugins [[dev.weavejester/lein-cljfmt "0.13.1"]]
:cljfmt {:extra-indents {merge-meta [[:inner 0]]}}}

:clj-kondo {:plugins [[com.github.clj-kondo/lein-clj-kondo "2025.04.07"]]}
:clj-kondo {:plugins [[com.github.clj-kondo/lein-clj-kondo "2025.09.22"]]}

:eastwood {:plugins [[jonase/eastwood "1.4.3"]]}})
167 changes: 80 additions & 87 deletions test/orchard/java/parser_next_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
[clojure.java.io :as io]
[clojure.string :as str]
[clojure.test :refer [deftest is testing]]
[matcher-combinators.matchers :as mc]
[orchard.java :as java]
[orchard.misc :as misc]
[orchard.test.util :as util])
[orchard.test.util :as util :refer [is+]])
(:import
(orchard.java DummyClass)))

Expand All @@ -30,85 +31,80 @@
(parse-java (io/resource "orchard/java/InvalidClass.java") nil)
(assert false)
(catch Exception e
(is (-> e ex-data :out (str/includes? "illegal start of expression"))))))))
(is+ {:out #"illegal start of expression"} (ex-data e)))))))

(when jdk11+?
(deftest source-info-test
(is (class? DummyClass))

(testing "file on the filesystem"
(is (= '{:doc-first-sentence-fragments
[{:type "text", :content "Class level docstring."}],
:column 1,
:line 12,
:class orchard.java.DummyClass,
:doc-fragments
[{:type "text", :content "Class level docstring.\n\n"}
{:type "html",
:content
"<pre> \n DummyClass dc = new DummyClass();\n </pre>"}],
:members
{dummyMethod
{[]
{:name dummyMethod,
:type java.lang.String,
:doc-first-sentence-fragments
[{:type "text", :content "Method-level docstring."}],
:column 5,
:argtypes [],
:non-generic-argtypes []
:line 18,
:argnames [],
:doc-fragments
[{:type "text", :content "Method-level docstring."}],
:doc-block-tags-fragments
[{:content "\n", :type "text"}
{:content "<i>Returns</i>:&nbsp;", :type "html"}
{:content "the string \"hello\"", :type "text"}],
:doc
"Method-level docstring.\n\n @return the string \"hello\""}}
orchard.java.DummyClass
{[]
{:non-generic-argtypes [],
:name orchard.java.DummyClass,
:type void,
:doc-first-sentence-fragments [],
:column 8,
:argtypes [],
:line 12,
:argnames [],
:doc-fragments [],
:doc-block-tags-fragments [],
:doc nil}}},
:doc-block-tags-fragments [],
:doc
"Class level docstring.\n\n <pre>\n DummyClass dc = new DummyClass();\n </pre>\n\n @author Arne Brasseur"}
(dissoc (source-info 'orchard.java.DummyClass)
:path
:resource-url))))))
(is+ '{:doc-first-sentence-fragments
[{:type "text", :content "Class level docstring."}],
:column 1,
:line 12,
:class orchard.java.DummyClass,
:doc-fragments
[{:type "text", :content "Class level docstring.\n\n"}
{:type "html",
:content
#"<pre> \n\s+DummyClass dc = new DummyClass\(\);\n\s+</pre>"}],
:members
{dummyMethod
{[]
{:name dummyMethod,
:type java.lang.String,
:doc-first-sentence-fragments
[{:type "text", :content "Method-level docstring."}],
:column 5,
:argtypes [],
:non-generic-argtypes []
:line 18,
:argnames [],
:doc-fragments
[{:type "text", :content "Method-level docstring."}],
:doc-block-tags-fragments
[{:content "\n", :type "text"}
{:content "<i>Returns</i>:&nbsp;", :type "html"}
{:content "the string \"hello\"", :type "text"}],
:doc
"Method-level docstring.\n\n @return the string \"hello\""}}
orchard.java.DummyClass
{[]
{:non-generic-argtypes [],
:name orchard.java.DummyClass,
:type void,
:doc-first-sentence-fragments [],
:column 8,
:argtypes [],
:line 12,
:argnames [],
:doc-fragments [],
:doc-block-tags-fragments [],
:doc nil}}},
:doc-block-tags-fragments [],
:doc
"Class level docstring.\n\n <pre>\n DummyClass dc = new DummyClass();\n </pre>\n\n @author Arne Brasseur"}
(source-info 'orchard.java.DummyClass)))))

(when (and jdk11+? util/jdk-sources-present?)
(deftest doc-fragments-test
(is (= [{:type "text", :content "Inserts the specified element at the tail of this queue if it is
(is+ [{:type "text", :content "Inserts the specified element at the tail of this queue if it is
possible to do so immediately without exceeding the queue's capacity,
returning "}
{:type "html", :content "<pre>true</pre> "}
{:type "text", :content " upon success and throwing an\n"}
{:type "html", :content "<pre>IllegalStateException</pre> "}
{:type "text", :content " if this queue is full."}]
(-> 'java.util.concurrent.ArrayBlockingQueue
source-info
(get-in [:members 'add '[java.lang.Object] :doc-fragments])))
"Returns a data structure with carefully managed whitespace location")
{:type "html", :content "<pre>true</pre> "}
{:type "text", :content " upon success and throwing an\n"}
{:type "html", :content "<pre>IllegalStateException</pre> "}
{:type "text", :content " if this queue is full."}]
(-> (source-info 'java.util.concurrent.ArrayBlockingQueue)
(get-in [:members 'add '[java.lang.Object] :doc-fragments]))
"Returns a data structure with carefully managed whitespace location")

(is (= {:content "<i>Param</i>&nbsp;<pre>obj</pre>:&nbsp;", :type "html"}
(-> `Thread
source-info
(get-in [:members 'holdsLock '[java.lang.Object] :doc-block-tags-fragments 1])))
"Formats params correctly")
(is+ {:content "<i>Param</i>&nbsp;<pre>obj</pre>:&nbsp;", :type "html"}
(-> (source-info `Thread)
(get-in [:members 'holdsLock '[java.lang.Object] :doc-block-tags-fragments 1]))
"Formats params correctly")

(let [fragments (-> `String
source-info
(let [fragments (-> (source-info `String)
(get-in [:members
'format
['java.util.Locale 'java.lang.String (symbol "java.lang.Object[]")]
Expand All @@ -123,28 +119,25 @@ returning "}

(when (and jdk11+? util/jdk-sources-present?)
(deftest smoke-test
(let [annotations #{'java.lang.Override
'java.lang.Deprecated
'java.lang.SuppressWarnings}
(let [exclusions '#{java.lang.Cloneable
java.lang.Override
java.lang.Deprecated
java.lang.SuppressWarnings}
corpus (->> ::_
namespace
symbol
util/imported-classes
(remove annotations)
(remove exclusions)
(into ['java.io.File]))]
(assert (> (count corpus)
50))
(doseq [class-sym corpus
:let [{:keys [members] :as info} (source-info class-sym)]]
(testing class-sym
(is (contains? info :doc))
(is (contains? info :doc-fragments))
(is (contains? info :doc-first-sentence-fragments))
(is (contains? info :members))
(let [v (mapcat vals (vals members))]
(when-not (#{`Cloneable} class-sym)
(is (seq v) (pr-str class-sym)))
(doseq [m v]
(is (contains? m :doc))
(is (contains? m :doc-fragments))
(is (contains? m :doc-first-sentence-fragments)))))))))
(when (is (> (count corpus) 50))
(doseq [class-sym corpus
:let [info (source-info class-sym)]]
(testing class-sym
(is+ {:doc any?, :doc-fragments any?, :doc-first-sentence-fragments any?
:members (mc/via
#(mapcat vals (vals %))
(mc/all-of not-empty
(mc/seq-of {:doc any?
:doc-fragments any?
:doc-first-sentence-fragments any?})))}
info)))))))