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