Clojure

print-deftype breaks when fields have dashes

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3, Release 1.4
  • Component/s: None
  • Labels:
    None

Description

user=> (deftype Foo [bar-quux])
user.Foo
user=> (def x (Foo. 1))
#'user/x 
user=> x
IllegalArgumentException No matching field found: bar-quux for class user.Foo  clojure.lang.Reflector.getInstanceField (Reflector.java:289)
#user.Foo[user=>

Printing records works fine. See this mailing list message for original report.

Activity

Hide
Aaron Bedra added a comment -

This patch breaks tests.

Show
Aaron Bedra added a comment - This patch breaks tests.
Hide
Alan Dipert added a comment -

Could you please attach your test output? I'm not able to reproduce.

Show
Alan Dipert added a comment - Could you please attach your test output? I'm not able to reproduce.
Hide
Aaron Bedra added a comment -

I attached the full test run. This is

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

on Ubuntu 11.04 64

Show
Aaron Bedra added a comment - I attached the full test run. This is java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode) on Ubuntu 11.04 64
Hide
Alan Dipert added a comment -

I haven't been able to reproduce your error. Could you try ant clean and run again? Perhaps another patch was also applied when you tested? Thanks in advance for giving it another shot.

Platforms I've tried that compile and test cleanly:

  • Mac OS X 10.6.8, 1.6.0_24-b07
  • Ubuntu 11.04 32, Sun JDK 1.6.0_24-b07
  • Ubuntu 11.04 64, Sun JDK 1.6.0_24-b07 (EC2, ami-1aad5273)
  • Ubuntu 11.04 64, OpenJDK 1.6.0_22 (EC2, ami-1aad5273)
  • CentOS 5.6 64, Sun JDK 1.6.0_27-ea
Show
Alan Dipert added a comment - I haven't been able to reproduce your error. Could you try ant clean and run again? Perhaps another patch was also applied when you tested? Thanks in advance for giving it another shot. Platforms I've tried that compile and test cleanly:
  • Mac OS X 10.6.8, 1.6.0_24-b07
  • Ubuntu 11.04 32, Sun JDK 1.6.0_24-b07
  • Ubuntu 11.04 64, Sun JDK 1.6.0_24-b07 (EC2, ami-1aad5273)
  • Ubuntu 11.04 64, OpenJDK 1.6.0_22 (EC2, ami-1aad5273)
  • CentOS 5.6 64, Sun JDK 1.6.0_27-ea
Hide
Kevin Downey added a comment -

this patch no longer applies cleanly

Show
Kevin Downey added a comment - this patch no longer applies cleanly
Hide
Andy Fingerhut added a comment -

The bad behavior appears not to exist in latest master as of Feb 24, 2012, nor does it exist in release 1.3.0. The code in the neighborhood of this one-line patch is significantly different than it was when the patch was made, so perhaps this issue was corrected as a side effect of some commit before the 1.3.0 release.

Mac OS X 10.6.8, 1.6.0_29, Clojure 1.3.0 test transcript:

Clojure 1.3.0
user=> (deftype Foo [bar-quux])
user.Foo
user=> (def x (Foo. 1))
#'user/x
user=> x
#<Foo user.Foo@6d080876>
user=> (deftype Bar [bar-id])
user.Bar
user=> (Bar. 1)
#<Bar user.Bar@679801c>
user=> (deftype Baz [bar_id])
user.Baz
user=> (Baz. 1)
#<Baz user.Baz@54128635>

Show
Andy Fingerhut added a comment - The bad behavior appears not to exist in latest master as of Feb 24, 2012, nor does it exist in release 1.3.0. The code in the neighborhood of this one-line patch is significantly different than it was when the patch was made, so perhaps this issue was corrected as a side effect of some commit before the 1.3.0 release. Mac OS X 10.6.8, 1.6.0_29, Clojure 1.3.0 test transcript: Clojure 1.3.0 user=> (deftype Foo [bar-quux]) user.Foo user=> (def x (Foo. 1)) #'user/x user=> x #<Foo user.Foo@6d080876> user=> (deftype Bar [bar-id]) user.Bar user=> (Bar. 1) #<Bar user.Bar@679801c> user=> (deftype Baz [bar_id]) user.Baz user=> (Baz. 1) #<Baz user.Baz@54128635>
Hide
Alan Dipert added a comment -

This issue does not exist in Clojure 1.3 onwards, and the attached patch is no longer relevant.

Show
Alan Dipert added a comment - This issue does not exist in Clojure 1.3 onwards, and the attached patch is no longer relevant.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: