Clojure

defprotocol doesn't resolve tag classnames

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5, Release 1.6
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Prescreened

Description

defprotocol doesn't resolve tag classnames, this results in exceptions being thrown when the declared protocol uses as a tag an imported class that is not imported in the namespace that uses it.

user=> (import 'clojure.lang.ISeq)
clojure.lang.ISeq
user=> (defprotocol p (^ISeq f [_]))
p
user=> (ns x)
nil
x=> (defn x [y] (let [z (user/f y)] (inc z)))
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ISeq, compiling:(NO_SOURCE_PATH:4:33)

Patch: clj-1180-2.patch

Screened by: Alex Miller

  • My only hesitancy with this patch is making the tagToClass public and reaching into it from core_deftype - this means that call into the Compiler needs to remain open forever as an api.
  1. 001-CLJ-1180.patch
    10/Mar/13 3:41 PM
    3 kB
    Nicola Mometto
  2. clj-1180-2.patch
    18/Jan/16 4:50 PM
    5 kB
    Alex Miller

Activity

Nicola Mometto made changes -
Field Original Value New Value
Attachment 001-CLJ-1180.patch [ 11904 ]
Nicola Mometto made changes -
Attachment 001-CLJ-1180.patch [ 11905 ]
Nicola Mometto made changes -
Attachment 001-CLJ-1180.patch [ 11904 ]
Andy Fingerhut made changes -
Patch Code and Test [ 10002 ]
Hide
Alex Miller added a comment -

Similer to CLJ-1232.

Show
Alex Miller added a comment - Similer to CLJ-1232.
Alex Miller made changes -
Labels protocols
Hide
Alex Miller added a comment -

Patch updates for current master, retains attribution.

Show
Alex Miller added a comment - Patch updates for current master, retains attribution.
Alex Miller made changes -
Approval Prescreened [ 10220 ]
Description defprotocol doesn't resolve tag classnames, this results in exceptions being thrown when the declared protocol uses as a tag an imported class that is not imported in the namespace that uses it.

user=> (import 'clojure.lang.ISeq)
clojure.lang.ISeq
user=> (defprotocol p (^ISeq f [_]))
p
user=> (ns x)
nil
x=> (defn x [y] (let [z (user/f y)] (inc z)))
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ISeq, compiling:(NO_SOURCE_PATH:4:33)
defprotocol doesn't resolve tag classnames, this results in exceptions being thrown when the declared protocol uses as a tag an imported class that is not imported in the namespace that uses it.

{code}
user=> (import 'clojure.lang.ISeq)
clojure.lang.ISeq
user=> (defprotocol p (^ISeq f [_]))
p
user=> (ns x)
nil
x=> (defn x [y] (let [z (user/f y)] (inc z)))
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: ISeq, compiling:(NO_SOURCE_PATH:4:33)
{code}

*Patch:* clj-1180-2.patch

*Screened by:* Alex Miller
- My only hesitancy with this patch is making the tagToClass public and reaching into it from core_deftype - this means that call into the Compiler needs to remain open forever as an api.
Attachment clj-1180-2.patch [ 15394 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: