<!-- 
RSS generated by JIRA (4.4#649-r158309) at Fri May 24 02:35:29 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-852/CLJ-852.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-852] IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-852</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;Note the following stacktrace line numbers are from the latest 1.4-snapshot, though this happens on 1.3 as well.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user=&amp;gt; (defn foo ^long [^long x] x)
#&apos;user/foo
user=&amp;gt; (def x (inc (foo 10)))
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: long, compiling:(NO_SOURCE_PATH:2) 
user=&amp;gt; (pst)
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: long, compiling:(NO_SOURCE_PATH:2)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:6444)
	clojure.lang.Compiler.analyze (Compiler.java:6244)
	clojure.lang.Compiler.analyze (Compiler.java:6205)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:6432)
	clojure.lang.Compiler.analyze (Compiler.java:6244)
	clojure.lang.Compiler.access$100 (Compiler.java:37)
	clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:492)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:6437)
	clojure.lang.Compiler.analyze (Compiler.java:6244)
	clojure.lang.Compiler.analyze (Compiler.java:6205)
	clojure.lang.Compiler.eval (Compiler.java:6497)
	clojure.lang.Compiler.eval (Compiler.java:6459)
Caused by:
IllegalArgumentException Unable to resolve classname: long
	clojure.lang.Compiler$HostExpr.tagToClass (Compiler.java:1003)
	clojure.lang.Compiler$InvokeExpr.getJavaClass (Compiler.java:3474)
	clojure.lang.Compiler.getMatchingParams (Compiler.java:2304)
	clojure.lang.Compiler$StaticMethodExpr.&amp;lt;init&amp;gt; (Compiler.java:1510)
	clojure.lang.Compiler$HostExpr$Parser.parse (Compiler.java:910)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:6437)
	clojure.lang.Compiler.analyze (Compiler.java:6244)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note though that the following works fine:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user=&amp;gt; (def x (foo (inc 10)))
#&apos;user/x
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14682">CLJ-852</key>
            <summary>IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="2" iconUrl="http://dev.clojure.org/jira/images/icons/priority_critical.gif">Critical</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="bsmith.occs@gmail.com">Ben Smith-Mannschott</assignee>
                                <reporter username="ataggart">Alexander Taggart</reporter>
                        <labels>
                    </labels>
                <created>Mon, 10 Oct 2011 15:24:07 -0500</created>
                <updated>Fri, 23 Mar 2012 08:40:35 -0500</updated>
                    <resolved>Fri, 23 Mar 2012 08:40:35 -0500</resolved>
                            <version>Release 1.3</version>
                                <fixVersion>Release 1.4</fixVersion>
                                        <due></due>
                    <votes>4</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="26984" author="bsmith.occs@gmail.com" created="Sat, 15 Oct 2011 10:13:52 -0500"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-852&quot; title=&quot;IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.&quot;&gt;&lt;del&gt;CLJ-852&lt;/del&gt;&lt;/a&gt;-test.patch &lt;br/&gt;
reproduces this issue on master&lt;/p&gt;</comment>
                    <comment id="26986" author="bsmith.occs@gmail.com" created="Sat, 15 Oct 2011 10:41:04 -0500"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-852&quot; title=&quot;IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.&quot;&gt;&lt;del&gt;CLJ-852&lt;/del&gt;&lt;/a&gt;-test.patch initially failed to use (is ...) leading to ugly output on failure.&lt;/p&gt;</comment>
                    <comment id="26990" author="bsmith.occs@gmail.com" created="Sat, 15 Oct 2011 14:59:56 -0500"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-852&quot; title=&quot;IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.&quot;&gt;&lt;del&gt;CLJ-852&lt;/del&gt;&lt;/a&gt;-rfc-fix.patch &lt;/p&gt;

&lt;p&gt;add special cases for &quot;int&quot;&#8230;&quot;boolean&quot; to tagToClass()&lt;/p&gt;

&lt;p&gt;This causes the test to pass, however, there are still some open questions:&lt;/p&gt;

&lt;p&gt;Why does tagToClass first call maybeClass and then possibly overwrite the result it gets back without even looking at it? This strikes me as surprising. I would have expected a check for null, and then only running the if/else chain of special cases if maybeClass failed to return a non-null result.&lt;/p&gt;

&lt;p&gt;The suppressed exception in maybeClass commented with &quot;//aargh&quot; makes me wonder if maybeClass and tagToClass are factored correctly.&lt;/p&gt;</comment>
                    <comment id="27087" author="stu" created="Tue, 25 Oct 2011 18:00:50 -0500"  >&lt;p&gt;This looks reasonable to me, but given the number of places tagToClass gets called I would definitely want Rich to take a look.&lt;/p&gt;</comment>
                    <comment id="27190" author="bsmith.occs@gmail.com" created="Wed, 2 Nov 2011 06:12:38 -0500"  >&lt;p&gt;See also&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/clojure/browse_thread/thread/f1672a7e09c34721&quot;&gt;http://groups.google.com/group/clojure/browse_thread/thread/f1672a7e09c34721&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="27283" author="bsmith.occs@gmail.com" created="Sun, 13 Nov 2011 09:18:53 -0600"  >&lt;p&gt;&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-852&quot; title=&quot;IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.&quot;&gt;&lt;del&gt;CLJ-852&lt;/del&gt;&lt;/a&gt;-fix.patch removes the RFC comments&lt;/p&gt;

&lt;p&gt;This fixes the issue. It appears to me like the cases &quot;int&quot; .. &quot;boolean&quot; (i.e. the non-array primitive types) were simply forgotten in tagToClass(). &lt;/p&gt;

&lt;p&gt;It&apos;s not impossible that tagToClass is being misused somehow ant that&apos;s the cause of the problem, but I see no evidence for that. (I&apos;d need a better understanding of the code base to make that determination &amp;#8211; mind reading skills would help too.)&lt;/p&gt;

&lt;p&gt;It&apos;s also conceivable that maybeClass() should be doing the resolution from primitive type to Class object, but that doesn&apos;t seem likely to me.&lt;/p&gt;</comment>
                    <comment id="27806" author="jafingerhut" created="Wed, 22 Feb 2012 21:02:15 -0600"  >&lt;p&gt;clj-852-patch2.txt is exactly the same as Ben&apos;s &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-852&quot; title=&quot;IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn.&quot;&gt;&lt;del&gt;CLJ-852&lt;/del&gt;&lt;/a&gt;-fix.patch (including keeping his name and dates on the commits), except:&lt;/p&gt;

&lt;p&gt;(1) I moved his new unit tests to an already-existing file metadata.clj, which seemed to have related tests with def and metadata, whereas Ben&apos;s patch adds a brand new test file.  Not sure whether keeping the number of files down is important or not.&lt;/p&gt;

&lt;p&gt;(2) I removed some non-ASCII characters from his commit notes.&lt;/p&gt;

&lt;p&gt;Both his patch and this newer one apply cleanly to latest master as of Feb 22, 2012.  Neither adds any new errors or warnings to compilation or tests (unless you apply the new test part of the patch without his proposed compiler fix, where the new test does fail as expected).  No docstrings need changing that I can think of.  Ben and I have both signed CAs.  Patch status is &quot;Code and Test&quot;.&lt;/p&gt;</comment>
                    <comment id="27845" author="stuart.sierra" created="Fri, 24 Feb 2012 13:32:36 -0600"  >&lt;p&gt;Screened. The addition seems harmless, merely recognizing more tags in tagToClass.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10701" name="CLJ-852-fix.patch" size="4697" author="bsmith.occs@gmail.com" created="Sun, 13 Nov 2011 09:18:53 -0600" />
                    <attachment id="10940" name="clj-852-patch2.txt" size="3595" author="jafingerhut" created="Wed, 22 Feb 2012 21:02:15 -0600" />
                    <attachment id="10401" name="CLJ-852-rfc-fix.patch" size="3639" author="bsmith.occs@gmail.com" created="Sat, 15 Oct 2011 14:59:56 -0500" />
                    <attachment id="10398" name="CLJ-852-test.patch" size="2200" author="bsmith.occs@gmail.com" created="Sat, 15 Oct 2011 10:41:04 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10002">Code and Test</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10003" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                <customfieldname>Waiting On</customfieldname>
                <customfieldvalues>
                    <customfieldvalue>richhickey</customfieldvalue>
                </customfieldvalues>
            </customfield>
                            </customfields>
    </item>
</channel>
</rss>