Who assigns value to `java.lang.constant.Constable`?

Lots of java classes are advertized in clojure as symbols containing the dot character. e.g.,
If I type either java.lang.constant.Constable or java.lang.constant.ConstantDesc at the repl, it evaluates to an object whose printed representation is identical to its symbol spelling, but whose type is class , i.e., class? returns true.

I have a couple of questions about these.

  1. is the . character in the symbol special syntax, or is it just an ordinary character in the spelling of the symbol, like a, b, and c?
  2. who sets the values of these? Is it done by automatically by clojure at startup, or is it a side effect of requiring something in a namespace?

Why do I ask? It is because I’m using something similar to (resolve 'java.lang.constant.Constable) in some of my test cases. When I run the test cases interactively within cider, and also from the shell command line via “lein test”, all the tests pass. However, when the tests are run in my gitLab CI pipeline, via “lein test” in a docker image (resolve 'java.lang.constant.Constable) evaluates to false. or at least the assertion (assert (resolve 'java.lang.constant.Constable)) fails.

What might be causes the CI pipeline to fail? Might it be a function of the java version? or a function of the clojure version? Can I require something in my namespace to assure that these symbols are resolvable?

Could it be something related to the JDK version you are using on you CI pipeline? You can get the java version via
(System/getProperty “java.version”)

Also to ensure if a class is in your class path, you can try to import it and if it is not available, then it most likely is a Java version issue:
(import 'java.lang.constant.Constable)

For example, in Java version < 12, you will get something like
user=> (import 'java.lang.constant.Constable)
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:381).
java.lang.constant.Constable

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.