question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More notes on class initialization

See original GitHub issue

https://github.com/lread/clj-graal-docs#class-initialization

See https://github.com/oracle/graal/discussions/3476

From Graal 22 on, the global --initialize-at-build-time option will be deprecated.

It is possible to get a list of Clojure-produced packages with something like:

(require 'babashka.main)
(->> (map ns-name (all-ns)) (remove #(str/starts-with? % "clojure")) (map #(str/split (str %) #"\.")) (keep butlast) (map #(str/join "." %)) distinct (map munge) (cons "clojure"))

and then make a comma separated list out of that:

"--initialize-at-build-time=clojure,sci.impl,selmer,babashka.nrepl,babashka.impl.clojure.java,babashka.impl,rewrite_clj.node,bencode,rewrite_clj.parser,babashka.impl.clojure,org.httpkit,rewrite_clj.custom_zipper,rewrite_clj.zip,borkdude.graal,babashka.nrepl.impl,babashka.pods,cognitect,babashka,edamame.impl,cheshire,rewrite_clj,hiccup,sci,borkdude,flatland.ordered,babashka.pods.impl,clj_yaml,babashka.impl.clojure.core,datascript,hf.depstar,babashka.impl.tools,sci.addons,babashka.impl.clojure.test"

This has an additional benefit that not all Java classes are initialized at build time, reducing the chance on any incorrect behavior.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
borkdudecommented, Sep 9, 2021

@ericdallo Made a repo here where we can implement this:

https://github.com/clj-easy/graal-build-time

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initializing Fields - Learning the Java Language
Instance variables can be initialized in constructors, where error handling or other logic can be used. To provide the same capability for class...
Read more >
Study guide: Class and object initialization - InfoWorld
This guide complements " Class and Object Initialization. ... from your fellow students, additional examples, and miscellaneous notes and thoughts.
Read more >
Objects and Classes: Constructors and Object Initialization
The next detail to note is how objects are created and initialized (i.e. values assigned to its instance variables and its methods names)...
Read more >
Initialization — The Swift Programming Language (Swift 5.7)
Initialization is the process of preparing an instance of a class, structure, or enumeration for use. This process involves setting an initial value...
Read more >
Initialization of base classes and members (C++ only) - IBM
Initializer list syntax ... If you do not explicitly initialize a base class or member that has constructors by calling a constructor, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found