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