Java Interop - unable to instantiate java.util.HashSet


I wish to confirm whether there exists a configuration limitation in the Clojure online test runner that prevents the use of Java classes, specifically the one mentioned in the title ?

My code executes on Clojure online platforms such as OneCompiler, but not under the Exercism online test runner (no, I do not have a local Clojure installation available).

The offending snippet:

(def +generated-names+ (new java.util.HashSet))

The corresponding test runner output:

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Unable to resolve classname: java.util.HashSet
Data:     {:type :sci/error, :line 11, :column 1, :file "/mnt/exercism-iteration/src/robot_name.clj", :phase "analysis"}
Location: /mnt/exercism-iteration/src/robot_name.clj:11:24
Phase:    analysis

----- Context ------------------------------------------------------------------
 7:   (:gen-class))
 9: (declare make-robot) 
11: (def +generated-names+ (new java.util.HashSet))
                           ^--- Unable to resolve classname: java.util.HashSet

I have no problem using other approaches to solve the exercise. I merely want to know why this particular Java interop is not working.

Thank you.

That’s because the interpreter used on exercism is babashka. It comes with limited functionality.

Here’s what you need to know:

Yes, that clears that mystery up !

I thought it might be a configuration issue, but did not delve because I’m trying to complete the remaining 12In23 exercises before the deadline.

Thank you, very much, for your help.