Created
February 14, 2024 14:25
-
-
Save fogus/2b3e8ae9c6f0643f615284084e9b37e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls | |
test$__STAR_.class | |
test$__STAR__STAR_.class | |
test$_main.class | |
test$loading__6798__auto____138.class | |
test__init.class | |
test$_init.class | |
test$fn__140.class | |
test.class | |
% javap test | |
public class foo.Test { | |
public final java.lang.Object ***; | |
public static {}; | |
public foo.Test(); | |
public boolean equals(java.lang.Object); | |
public java.lang.String toString(); | |
public int hashCode(); | |
public java.lang.Object clone(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def t (foo.Test.)) | |
(.-*** t) | |
Execution error (IllegalArgumentException) at user/eval150 (REPL:1). | |
No matching field found: _STAR__STAR__STAR_ for class foo.Test | |
(clojure.lang.Reflector/getField foo.Test "***" false) | |
#object[java.lang.reflect.Field 0x551de37d "public final java.lang.Object foo.Test.***"] | |
(-> t .getClass (.getDeclaredField "***") (.get t) deref) | |
42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.test | |
(:gen-class)) | |
(gen-class | |
:name "foo.Test" | |
:state "***" | |
:init "init" | |
:prefix "-" | |
;; :methods [[* [] String] uncommenting causes compilation error | |
;; [** [] String]] | |
) | |
(defn -init [] | |
[[] (atom 42)]) | |
(defn -* [this] | |
"one star") | |
(defn -** | |
[this] | |
"two stars") | |
(defn -main [& args] | |
(-*) | |
(-**)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment