评论者:sonicsmooth
感谢您发布这个补丁。静态初始化器的问题使得同时进行AOT和交互式开发JavaFX变得困难。我今天克隆了Clojure 1.9.0-master源代码并应用了这个补丁,但示例Clojure项目仍然显示“正在执行静态初始化!”我已经验证这是我实际用例的情况。如果先启动JFXPanel,错误就会消失。截至2017年9月,是否有解决方法,例如以另一种方式定义代理或延迟到运行时?谢谢。
$ lein clean;lein repl
编译1个源文件到C:\dev\clojure\clojure-static-initialization\target\classes
编译clojure-static-initialization.gen-class-demo
编译clojure-static-initialization.proxy-demo
正在执行静态初始化!
Clojure 1.9.0-master-SNAPSHOT
user=> (def lcp (proxy (link: javafx.scene.control.ListCell) (link: )))
编译器异常java.lang.ExceptionInInitializerError,编译[(C:\dev\clojure\clojure-static-initialization\target\f31ee90298a1be447b450330204c3c0806c08b96-init.clj:1:10)
$ lein clean;lein repl
编译1个源文件到C:\dev\clojure\clojure-static-initialization\target\classes
编译clojure-static-initialization.gen-class-demo
编译clojure-static-initialization.proxy-demo
正在执行静态初始化!
Clojure 1.9.0-master-SNAPSHOT
user=> (def jfxpanel (javafx.embed.swing.JFXPanel.))
'user/jfxpanel
user=> (def lcp (proxy (link: javafx.scene.control.ListCell) (link: )))
'user/lcp