Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Errors by

In a situation where you define a protocol, and then define a class that extends that protocol (e.g., reify, defrecord, deftype) and then later, re-define the protocol (typically, by reloading the namespace that defines the protocol), then the existing instances are no longer valid.

However, the exception that gets generated can be confusing:

`

 java.lang.IllegalArgumentException: No implementation of method: :injections of protocol: #'fan.microservice/MicroService found for class: fan.auth.AuthService
                                       clojure.core/-cache-protocol-fn                  core_deftype.clj:  544
                                       fan.microservice/eval23300/fn/G                  microservice.clj:   12
                                                   clojure.core/map/fn                          core.clj: 2559
                                             clojure.lang.LazySeq.sval                      LazySeq.java:   40
                                              clojure.lang.LazySeq.seq                      LazySeq.java:   49
                                                clojure.lang.Cons.next                         Cons.java:   39
                                         clojure.lang.RT.boundedLength                           RT.java: 1654
                                           clojure.lang.RestFn.applyTo                       RestFn.java:  130
                                                    clojure.core/apply                          core.clj:  626
             fan.microservice.StandardContainer/construct-ring-handler                  microservice.clj:   51

`

The confusing part is that (in the above example) AuthService does extend MicroService, just not the correct version of it.

The exception message should be extended to identify that this is "possibly because the protocol was reloaded since the class was defined."

A patch will be ready shortly.

2 Answers

0 votes
by

Comment made by: hlewisship

Patch with tests

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1490 (reported by hlewisship)
...