Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: Release 1.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Clojure 1.4
Description
(defprotocol P (-foo [this]))
This code generates a reflective call to a non-existing foo field instead of the correct -foo method.
I was told by Christophe Grand that changing the line 557 in core_deftype.clj from:
(. ~(with-meta target {:tag on-interface}) ~(or on-method method) ~@(rest gargs))
to
(. ~(with-meta target {:tag on-interface}) (~(or on-method method) ~@(rest gargs)))
is a quick fix. However I don't know too much about the compilation specifics of . to judge whether this is the correct fix.
Issue reproduction:
Clojure user=> (set! *warn-on-reflection* true) true user=> (defprotocol P (-foo [this])) P Reflection warning, REPL:4 - reference to field foo can't be resolved.
Activity
Meikel Brandmeyer
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
{code}
(defprotocol P (-foo [this])) {code} This code generates a reflective call to a non-existing {{foo}} field instead of the correct {{-foo}} method. I was told by Christophe Grand that changing the [line 557 in core_deftype.clj|https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L557] from: {code} (. ~(with-meta target {:tag on-interface}) ~(or on-method method) ~@(rest gargs)) {code} to {code} (. ~(with-meta target {:tag on-interface}) (~(or on-method method) ~@(rest gargs))) {code} is a quick fix. However I don't know too much about the compilation specifics of {{.}} to judge whether this the correct fix. Issue reproduction: {code} Clojure user=> (set! *warn-on-reflection* true) true user=> (defprotocol P (-foo [this])) P Reflection warning, REPL:4 - reference to field foo can't be resolved. {code} |
{code}
(defprotocol P (-foo [this])) {code} This code generates a reflective call to a non-existing {{foo}} field instead of the correct {{-foo}} method. I was told by Christophe Grand that changing the [line 557 in core_deftype.clj|https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L557] from: {code} (. ~(with-meta target {:tag on-interface}) ~(or on-method method) ~@(rest gargs)) {code} to {code} (. ~(with-meta target {:tag on-interface}) (~(or on-method method) ~@(rest gargs))) {code} is a quick fix. However I don't know too much about the compilation specifics of {{.}} to judge whether this is the correct fix. Issue reproduction: {code} Clojure user=> (set! *warn-on-reflection* true) true user=> (defprotocol P (-foo [this])) P Reflection warning, REPL:4 - reference to field foo can't be resolved. {code} |
Gabriel Horner
made changes -
| Resolution | Duplicate [ 3 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |