zen-lang / zen

Library for model driven systems
116 stars 12 forks source link

No matching method valueOf found taking 1 args exception. #45

Closed qdzo closed 1 year ago

qdzo commented 1 year ago

Encountered this error. Looks like there are some stale or broken code

No matching method valueOf found taking 1 args java.lang.IllegalArgumentException: No matching method valueOf found taking 1 args
 at clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:154)
    clojure.lang.Reflector.invokeStaticMethod (Reflector.java:332)
    zen.v2_validation$fn__8257$fn__8258.invoke (v2_validation.clj:393)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$get_cached$fn__8146.invoke (v2_validation.clj:182)
    zen.v2_validation$fn__8309$keys_sch__8316.invoke (v2_validation.clj:514)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$fn__8309$keys_sch__8316.invoke (v2_validation.clj:514)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$fn__8335$fn__8339$err_fn__8341.invoke (v2_validation.clj:547)
    clojure.lang.ArrayChunk.reduce (ArrayChunk.java:58)
    clojure.core.protocols$fn__8244.invokeStatic (protocols.clj:136)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8204$G__8199__8213.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8236.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8178$G__8173__8191.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6886)
    clojure.core$reduce.invoke (core.clj:6868)
    zen.v2_validation$fn__8335$fn__8339.invoke (v2_validation.clj:561)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$fn__8309$keys_sch__8316.invoke (v2_validation.clj:514)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$get_cached$fn__8146.invoke (v2_validation.clj:182)
    zen.v2_validation$fn__8381$fn__8383.invoke (v2_validation.clj:674)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$get_cached$fn__8146.invoke (v2_validation.clj:182)
    zen.v2_validation$fn__8362$confirms_sch__8366.invoke (v2_validation.clj:618)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$fn__8309$keys_sch__8316.invoke (v2_validation.clj:514)
    zen.v2_validation$compile_schema$compiled_sch__8136.invoke (v2_validation.clj:162)
    zen.v2_validation$get_cached$fn__8146.invoke (v2_validation.clj:182)
    zen.v2_validation$_STAR_validate_schema.invokeStatic (v2_validation.clj:219)
    zen.v2_validation$_STAR_validate_schema.invoke (v2_validation.clj:209)
    zen.v2_validation$validate_schema.invokeStatic (v2_validation.clj:228)
    zen.v2_validation$validate_schema.doInvoke (v2_validation.clj:221)
xamelon commented 1 year ago

Validation of :scale key uses BigDecimal/valueOf.

BigDecimal/valueOf fails if pass java.lang.Integer into it

qdzo commented 1 year ago

Maybe we need to add here coercion to double - like (BigDecimal/valueOf (double x)) or we need to test different cases.