Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.sql.* classes not available from the boot classpath #1

Open
tobias opened this issue Nov 22, 2016 · 6 comments
Open

java.sql.* classes not available from the boot classpath #1

tobias opened this issue Nov 22, 2016 · 6 comments

Comments

@tobias
Copy link
Owner

tobias commented Nov 22, 2016

Not all of the java standard library is available to the boot classloader, which prevents Clojure from loading if put on the boot classpath. This manifests as a failure to load clojure.instant, since it imports java.sql.Timestamp. This can be recreated with:

java -Xbootclasspath/a:clojure-1.9.0-alpha14.jar clojure.main -e "(require 'clojure.instant)"

This prevents Leiningen from working at all with Java 9, since the lein uberjar is loaded from the boot classpath to reduce startup time. See technomancy/leiningen#2149

@tobias tobias changed the title java.sql not available from the boot classpath java.sql.* classes not available from the boot classpath Nov 22, 2016
@tobias
Copy link
Owner Author

tobias commented Dec 6, 2016

Filed with Clojure as http://dev.clojure.org/jira/browse/CLJ-2077

@AlanBateman
Copy link

I can't comment on why -Xbootclasspath/a is being used but I'm curious why clojure.instant uses java.sql.Timestamp. I would think the java.time API (in the java.base) would be a better choice.

@puredanger
Copy link

@AlanBateman because this predates the existence of java.time, which was added in Java 8. Clojure currently supports back to Java 6.

@hypirion
Copy link

@AlanBateman: -Xbootclasspath is used to reduce startup time (it skips bytecode verification and some other things). Some benchmarks were provided over at http://dev.clojure.org/jira/browse/CLJ-2077

@AlanBateman
Copy link

Okay, I just wanted to make you aware of java.time in case it was overlooked. It may be that clojure.instant could use that in the future.

As regards the startup impact then has anyone profiled this to see if there are any opportunities? If Clojure is compiled to JDK 6 then I assume version 50.0 class files with stack maps, is that right? Just wondering if the verification is being done by type inference rather than type checking. In any case, if it is common to deploy it with -Xbootclasspath/a then the only types that you depend on being visible are the types in the java.base module. Yes, this is an incompatible change and stems from the effort to improve the security of the platform by moving non-core modules from the boot loader to the platform class loader (platform class loader replaced was used to be called the "extension" class loader).

@puredanger
Copy link

Clojure compiled code does not currently use stackmaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants