Skip to content

Commit 039b069

Browse files
[inspect] Display class flags
1 parent cf1aa5f commit 039b069

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [#346](https://github.com/clojure-emacs/orchard/pull/346): Inspector: only show those datafied collection items that have unique datafy represantation.
66
- [#348](https://github.com/clojure-emacs/orchard/pull/348): Inspector: display length of inspected strings.
7+
- [#348](https://github.com/clojure-emacs/orchard/pull/348): Inspector: display class flags.
78

89
## 0.35.0 (2025-05-28)
910

src/orchard/inspect.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Pretty wild, right?"
1111
(:require
1212
[clojure.core.protocols :refer [datafy nav]]
13+
[clojure.reflect :as reflect]
1314
[clojure.string :as str]
1415
[orchard.inspect.analytics :as analytics]
1516
[orchard.java.compatibility :as compat]
@@ -955,6 +956,10 @@
955956
(-> inspector
956957
(render-labeled-value "Name" (-> obj .getName symbol))
957958
(render-class-name obj)
959+
(render "Flags: " (->> (#'clojure.reflect/parse-flags (.getModifiers obj) :class)
960+
(map name)
961+
(str/join " ")))
962+
(render-ln)
958963
(render-class-hierarchy obj)
959964
(render-class-section :Constructors (.getConstructors obj)
960965
(print-fn #(.toGenericString ^Constructor %)))

test/orchard/inspect_test.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,8 @@
931931
(testing "renders the header section"
932932
(is+ ["Name: "
933933
[:value "java.lang.Object" 0] [:newline]
934-
"Class: " [:value "java.lang.Class" 1] [:newline] [:newline]]
934+
"Class: " [:value "java.lang.Class" 1] [:newline]
935+
"Flags: public" [:newline] [:newline]]
935936
(header rendered)))
936937
(testing "renders the constructors section"
937938
(is+ ["--- Constructors:"
@@ -997,7 +998,8 @@
997998
(testing "renders the header section"
998999
(is+ ["Name: "
9991000
[:value "java.lang.ClassValue" 0] [:newline]
1000-
"Class: " [:value "java.lang.Class" 1] [:newline] [:newline]]
1001+
"Class: " [:value "java.lang.Class" 1] [:newline]
1002+
"Flags: public abstract" [:newline] [:newline]]
10011003
(header rendered)))
10021004
(testing "renders the methods section"
10031005
(let [methods (section rendered "Methods")]

0 commit comments

Comments
 (0)