评论者: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