Skip to content

Instantly share code, notes, and snippets.

@ragnard
Last active October 10, 2017 18:51
Show Gist options
  • Save ragnard/40c81980c1c15a495a724b361a020500 to your computer and use it in GitHub Desktop.
Save ragnard/40c81980c1c15a495a724b361a020500 to your computer and use it in GitHub Desktop.
Clojure and static class initialization
(ns javafx
(:import (javafx.scene.control Cell)))
(defn f
[]
Cell)
Classfile /Users/ragnardahlen/projects/github/ragnard/clojure-javafx-java9/classes/javafx$f.class
Last modified Oct 10, 2017; size 666 bytes
MD5 checksum 2c4c877443f9b9ceec32fae5c3481caa
Compiled from "javafx.clj"
public final class javafx$f extends clojure.lang.AFunction
minor version: 0
major version: 49
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
Constant pool:
#1 = Utf8 javafx$f
#2 = Class #1 // javafx$f
#3 = Utf8 clojure/lang/AFunction
#4 = Class #3 // clojure/lang/AFunction
#5 = Utf8 javafx.clj
#6 = Utf8 <init>
#7 = Utf8 ()V
#8 = NameAndType #6:#7 // "<init>":()V
#9 = Methodref #4.#8 // clojure/lang/AFunction."<init>":()V
#10 = Utf8 invokeStatic
#11 = Utf8 ()Ljava/lang/Object;
#12 = Utf8 const__0
#13 = Utf8 Ljava/lang/Object;
#14 = NameAndType #12:#13 // const__0:Ljava/lang/Object;
#15 = Fieldref #2.#14 // javafx$f.const__0:Ljava/lang/Object;
#16 = Utf8 invoke
#17 = NameAndType #10:#11 // invokeStatic:()Ljava/lang/Object;
#18 = Methodref #2.#17 // javafx$f.invokeStatic:()Ljava/lang/Object;
#19 = Utf8 <clinit>
#20 = Utf8 javafx.scene.control.Cell
#21 = String #20 // javafx.scene.control.Cell
#22 = Utf8 clojure/lang/RT
#23 = Class #22 // clojure/lang/RT
#24 = Utf8 classForName
#25 = Utf8 (Ljava/lang/String;)Ljava/lang/Class;
#26 = NameAndType #24:#25 // classForName:(Ljava/lang/String;)Ljava/lang/Class;
#27 = Methodref #23.#26 // clojure/lang/RT.classForName:(Ljava/lang/String;)Ljava/lang/Class;
#28 = Utf8 Code
#29 = Utf8 LineNumberTable
#30 = Utf8 SourceFile
#31 = Utf8 SourceDebugExtension
{
public static final java.lang.Object const__0;
descriptor: Ljava/lang/Object;
flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
public javafx$f();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #9 // Method clojure/lang/AFunction."<init>":()V
4: return
LineNumberTable:
line 4: 0
public static java.lang.Object invokeStatic();
descriptor: ()Ljava/lang/Object;
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: getstatic #15 // Field const__0:Ljava/lang/Object;
3: areturn
LineNumberTable:
line 4: 0
public java.lang.Object invoke();
descriptor: ()Ljava/lang/Object;
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: invokestatic #18 // Method invokeStatic:()Ljava/lang/Object;
3: areturn
LineNumberTable:
line 4: 0
public static {};
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: ldc #21 // String javafx.scene.control.Cell
2: invokestatic #27 // Method clojure/lang/RT.classForName:(Ljava/lang/String;)Ljava/lang/Class;
5: putstatic #15 // Field const__0:Ljava/lang/Object;
8: return
LineNumberTable:
line 4: 0
}
SourceFile: "javafx.clj"
SourceDebugExtension:
SMAP
javafx.java
Clojure
*S Clojure
*F
+ 1 javafx.clj
javafx.clj
*L
2#1,5:2
*E
#error {
:cause "Toolkit not initialized"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "java.lang.ExceptionInInitializerError, compiling:(javafx.clj:4:1)"
:at [clojure.lang.Compiler$DefExpr eval "Compiler.java" 470]}
{:type java.lang.ExceptionInInitializerError
:message nil
:at [java.lang.Class forName0 "Class.java" -2]}
{:type java.lang.IllegalStateException
:message "Toolkit not initialized"
:at [com.sun.javafx.application.PlatformImpl runLater "PlatformImpl.java" 273]}]
:trace
[[com.sun.javafx.application.PlatformImpl runLater "PlatformImpl.java" 273]
[com.sun.javafx.application.PlatformImpl runLater "PlatformImpl.java" 268]
[com.sun.javafx.application.PlatformImpl setPlatformUserAgentStylesheet "PlatformImpl.java" 550]
[com.sun.javafx.application.PlatformImpl setDefaultPlatformUserAgentStylesheet "PlatformImpl.java" 512]
[javafx.scene.control.Control <clinit> "Control.java" 87]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 348]
[clojure.lang.RT classForName "RT.java" 2204]
[clojure.lang.RT classForName "RT.java" 2213]
[javafx$f <clinit> "javafx.clj" 4]
[sun.reflect.NativeConstructorAccessorImpl newInstance0 "NativeConstructorAccessorImpl.java" -2]
[sun.reflect.NativeConstructorAccessorImpl newInstance "NativeConstructorAccessorImpl.java" 62]
[sun.reflect.DelegatingConstructorAccessorImpl newInstance "DelegatingConstructorAccessorImpl.java" 45]
[java.lang.reflect.Constructor newInstance "Constructor.java" 423]
[java.lang.Class newInstance "Class.java" 442]
[clojure.lang.Compiler$ObjExpr eval "Compiler.java" 4989]
[clojure.lang.Compiler$DefExpr eval "Compiler.java" 457]
[clojure.lang.Compiler eval "Compiler.java" 7067]
[clojure.lang.Compiler load "Compiler.java" 7514]
[clojure.lang.RT loadResourceScript "RT.java" 379]
[clojure.lang.RT loadResourceScript "RT.java" 370]
[clojure.lang.RT load "RT.java" 460]
[clojure.lang.RT load "RT.java" 426]
[clojure.core$load$fn__6550 invoke "core.clj" 6051]
[clojure.core$load invokeStatic "core.clj" 6050]
[clojure.core$load doInvoke "core.clj" 6034]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5853]
[clojure.core$load_one invoke "core.clj" 5848]
[clojure.core$load_lib$fn__6495 invoke "core.clj" 5893]
[clojure.core$load_lib invokeStatic "core.clj" 5892]
[clojure.core$load_lib doInvoke "core.clj" 5873]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 659]
[clojure.core$load_libs invokeStatic "core.clj" 5930]
[clojure.core$load_libs doInvoke "core.clj" 5914]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 659]
[clojure.core$require invokeStatic "core.clj" 5952]
[clojure.core$require doInvoke "core.clj" 5952]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[user$eval11 invokeStatic "NO_SOURCE_FILE" 1]
[user$eval11 invoke "NO_SOURCE_FILE" 1]
[clojure.lang.Compiler eval "Compiler.java" 7062]
[clojure.lang.Compiler eval "Compiler.java" 7025]
[clojure.core$eval invokeStatic "core.clj" 3211]
[clojure.core$eval invoke "core.clj" 3207]
[clojure.main$repl$read_eval_print__8574$fn__8577 invoke "main.clj" 243]
[clojure.main$repl$read_eval_print__8574 invoke "main.clj" 243]
[clojure.main$repl$fn__8583 invoke "main.clj" 261]
[clojure.main$repl invokeStatic "main.clj" 261]
[clojure.main$repl_opt invokeStatic "main.clj" 325]
[clojure.main$main invokeStatic "main.clj" 424]
[clojure.main$main doInvoke "main.clj" 387]
[clojure.lang.RestFn invoke "RestFn.java" 397]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.RestFn applyTo "RestFn.java" 132]
[clojure.lang.Var applyTo "Var.java" 702]
[clojure.main main "main.java" 37]]}
import javafx.scene.control.Cell;
public class JavaFX {
public static Class f() {
return Cell.class;
}
}
Classfile /Users/ragnardahlen/projects/github/ragnard/clojure-javafx-java9/JavaFX.class
Last modified Oct 10, 2017; size 284 bytes
MD5 checksum c49770cd39de3234f25104e32bc37aa0
Compiled from "JavaFX.java"
public class JavaFX
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #4.#13 // java/lang/Object."<init>":()V
#2 = Class #14 // javafx/scene/control/Cell
#3 = Class #15 // JavaFX
#4 = Class #16 // java/lang/Object
#5 = Utf8 <init>
#6 = Utf8 ()V
#7 = Utf8 Code
#8 = Utf8 LineNumberTable
#9 = Utf8 f
#10 = Utf8 ()Ljava/lang/Class;
#11 = Utf8 SourceFile
#12 = Utf8 JavaFX.java
#13 = NameAndType #5:#6 // "<init>":()V
#14 = Utf8 javafx/scene/control/Cell
#15 = Utf8 JavaFX
#16 = Utf8 java/lang/Object
{
public JavaFX();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 3: 0
public static java.lang.Class f();
descriptor: ()Ljava/lang/Class;
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: ldc #2 // class javafx/scene/control/Cell
2: areturn
LineNumberTable:
line 5: 0
}
SourceFile: "JavaFX.java"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment