Skip to content

@timmc /1.repl.clj
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Compiling Java against a class with abstract methods
;; Spit reified class to disk
(alter-var-root #'*compile-files* (constantly true))
;;=> true
;; Create an abstract-ish class
(class (reify java.util.List (size [this] 10)))
;;=> clj.core$eval1062$reify__1063
;; Nope, it's not an "abstract class"
(java.lang.reflect.Modifier/isAbstract (.getModifiers clj.core$eval1062$reify__1063))
;;=> false
*compile-path*
;;=> "/home/timmc/tmp/clj/target/classes"
// In /home/timmc/tmp/clj/
public class Test {
public static void main(String[] args) {
System.out.println(new clj.core$eval1062$reify__1063().size());
}
}
# In /home/timmc/tmp/clj/
javac -cp target/classes/ Test.java
mv Test.class target/classes/
java -cp target/classes/:/home/timmc/.m2/repository/org/clojure/clojure/1.4.0/clojure-1.4.0.jar Test
#=> 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.