Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Issue with class redefinition

...

Building interface: https://github.com/frenchy64/analyze/blob/master/src/analyze/core.clj

Issues

Redefinition of Classes at Compile time

Running `clojure.core` through the analyzer attempts to redefine functions at (what seems to be) macroexpand time.

Code Block
CompilerException java.lang.LinkageError: loader (instance of clojure/lang/DynamicClassLoader): attempted duplicate class definition for name: "clojure/core$booleans", compiling:(REPL:4)
 clojure.lang.Compiler.analyzeSeq (Compiler.java:6416)
 clojure.lang.Compiler.analyze (Compiler.java:6216)
 clojure.lang.Compiler.analyzeSeq (Compiler.java:6397)
 clojure.lang.Compiler.analyze (Compiler.java:6216)
 clojure.lang.Compiler.analyze (Compiler.java:6177)
 clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3503)
 clojure.lang.Compiler.analyzeSeq (Compiler.java:6411)
 clojure.lang.Compiler.analyze (Compiler.java:6216)
 clojure.lang.Compiler.analyze (Compiler.java:6177)
 clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5572)
 clojure.lang.Compiler.analyzeSeq (Compiler.java:6409)
 clojure.lang.Compiler.analyze (Compiler.java:6216)
Caused by:
LinkageError loader (instance of clojure/lang/DynamicClassLoader): attempted duplicate class definition for name: "clojure/core$booleans"
 java.lang.ClassLoader.defineClass1 (ClassLoader.java:-2)
 java.lang.ClassLoader.defineClassCond (ClassLoader.java:631)
 java.lang.ClassLoader.defineClass (ClassLoader.java:615)
 java.lang.ClassLoader.defineClass (ClassLoader.java:465)
 clojure.lang.DynamicClassLoader.defineClass (DynamicClassLoader.java:46)
 clojure.lang.Compiler$ObjExpr.getCompiledClass (Compiler.java:4533)
 clojure.lang.Compiler$FnExpr.parse (Compiler.java:3697)
 clojure.lang.Compiler.analyzeSeq (Compiler.java:6407)
 clojure.lang.Compiler.analyze (Compiler.java:6216)

Offending line in `clojure.core`:

Code Block
(definline booleans
  "Casts to boolean[]"
  {:added "1.1"}
  [xs] `(. clojure.lang.Numbers booleans ~xs))

I don't have a good idea how to fix this. Maybe a flag that indicates to catch a redefinition error, and then lookup the class in the cache?