Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add many patches, and modify build.sh

build.sh now applies patches using 'git am' instead of patch.  A bit
slower, but it preserves info about the developers who created the
patches.

It also now applies the patches in the order specified in the file
patch-order.txt.  There are some pairs of patches that apply cleanly
in one order but not the opposite order.
  • Loading branch information...
commit 06a45eb98c57c159efa7f7015e8ff20107e9e69f 1 parent bb0c71f
@jafingerhut authored
Showing with 2,501 additions and 779 deletions.
  1. +7 −6 build.sh
  2. +100 −0 patches/0001-Fix-CLJ-931-Syntactically-broken-clojure.test-are-te.patch
  3. +28 −0 patches/0002-report-load-exceptions-with-file-and-line.diff
  4. +218 −0 patches/CLJ-753-870-905-combined-fix3.patch
  5. +177 −0 patches/CLJ-768-patch-for-after-CLJ-881-fixed.patch
  6. +0 −773 patches/CLJ-855-sneaky-throw.patch
  7. +68 −0 patches/CLJ-881-patch-from-dimitrov.txt
  8. +180 −0 patches/CLJ-886-fix2.patch
  9. +50 −0 patches/CLJ-932-0001.patch
  10. +38 −0 patches/add-enable-locals-clearing-updated.diff
  11. +45 −0 patches/capitalize-for-supplementary-chars-patch.txt
  12. +80 −0 patches/cl-format-efg-coerce-ratios-to-doubes-patch1.txt
  13. +177 −0 patches/clj-667-allow-loop-recur-nested-in-catch-and-finally-patch2.txt
  14. +40 −0 patches/clj-757-fix-behavior-of-empty-transient-maps-patch2.txt
  15. +45 −0 patches/clj-783-patch.txt
  16. +27 −0 patches/clj-831-await-for-doc-string-patch.txt
  17. +109 −0 patches/clj-833-defrecord-factory-docstrings-3.patch
  18. +99 −0 patches/clj-850-type-hinted-fn-abstractmethoderror-patch2.txt
  19. +75 −0 patches/clj-873-namespace-divides-patch.txt
  20. +30 −0 patches/clj-893-doc-vec-aliases-java-array-patch.txt
  21. +601 −0 patches/clj-894-better-reduce-performance-patch2.txt
  22. +91 −0 patches/clj-896-browse-url-uses-xdg-open-patch2.txt
  23. +50 −0 patches/clj-902-doc-on-namespaces-patch.txt
  24. +53 −0 patches/clj-923-reading-ratios-prefixed-by-plus-patch.txt
  25. +80 −0 patches/fix-trim-fns-different-whitespace-patch.txt
  26. +33 −0 patches/patch-order.txt
View
13 build.sh
@@ -1,6 +1,8 @@
-#!/bin/sh
+#!/bin/bash
-CLOJURE_SHA="b62df08fc3567d17cca68acfaa96adba2880126d"
+set -e
+
+CLOJURE_SHA="4be26980e2c4a983045f0b60e7d44a6f38066c6b"
[ ! -e clojure ] && git clone http://github.com/clojure/clojure
@@ -14,10 +16,9 @@ for i in `git status --porcelain|cut -d \ -f 2`; do rm -rf $i; done
git reset --hard $CLOJURE_SHA
-for i in `ls ../patches`; do
- echo "applying" $i
- patch --strip 1 < ../patches/$i > /dev/null
- [ ! 0 -eq $? ] && echo "$i failed to apply"
+for i in `cat ../patches/patch-order.txt`; do
+ echo " applying" $i
+ git am -s < ../patches/$i
done
MAVEN_OPTS="-Djava.awt.headless=true"
View
100 patches/0001-Fix-CLJ-931-Syntactically-broken-clojure.test-are-te.patch
@@ -0,0 +1,100 @@
+From bcf97df0cca7c71a0f13d372e780f83ed04b09e3 Mon Sep 17 00:00:00 2001
+From: Tassilo Horn <tassilo@member.fsf.org>
+Date: Fri, 17 Feb 2012 11:02:32 +0100
+Subject: [PATCH] Fix CLJ-931: Syntactically broken clojure.test/are tests
+ succeed.
+
+Also added a testcase for my fix, but it is commented out because it fails when
+run by "ant test". However, if you fire up a REPL and run the test inside
+that, it passes just fine.
+
+Also fixed a test case in test/clojure/test_clojure/java_interop.clj only
+because of the bug in clojure.test/are CLJ-931 is about.
+---
+ src/clj/clojure/test.clj | 10 +++++++++-
+ test/clojure/test_clojure/java_interop.clj | 16 ++++++++--------
+ test/clojure/test_clojure/test.clj | 20 ++++++++++++++++++++
+ 3 files changed, 37 insertions(+), 9 deletions(-)
+
+diff --git a/src/clj/clojure/test.clj b/src/clj/clojure/test.clj
+index 2725e20..a393b4f 100644
+--- a/src/clj/clojure/test.clj
++++ b/src/clj/clojure/test.clj
+@@ -568,7 +568,15 @@
+ Note: This breaks some reporting features, such as line numbers."
+ {:added "1.1"}
+ [argv expr & args]
+- `(temp/do-template ~argv (is ~expr) ~@args))
++ (if (or
++ ;; (are [] true) is meaningless but ok
++ (and (empty? argv) (empty? args))
++ ;; Catch wrong number of args
++ (and (pos? (count argv))
++ (pos? (count args))
++ (zero? (mod (count args) (count argv)))))
++ `(temp/do-template ~argv (is ~expr) ~@args)
++ (throw (IllegalArgumentException. "The number of args doesn't match are's argv."))))
+
+ (defmacro testing
+ "Adds a new string to the list of testing contexts. May be nested,
+diff --git a/test/clojure/test_clojure/java_interop.clj b/test/clojure/test_clojure/java_interop.clj
+index 059ef11..7e73784 100644
+--- a/test/clojure/test_clojure/java_interop.clj
++++ b/test/clojure/test_clojure/java_interop.clj
+@@ -41,14 +41,14 @@
+ (. Math (abs -7)) )
+
+ ; (. target -prop)
+- (are [x y] (= x y)
+- (let [p (java.awt.Point. 1 2)]
+- 1 (.-x p)
+- 2 (.-y p)
+- 1 (. p -x)
+- 2 (. p -y)
+- 1 (. (java.awt.Point. 1 2) -x)
+- 2 (. (java.awt.Point. 1 2) -y)))
++ (let [p (java.awt.Point. 1 2)]
++ (are [x y] (= x y)
++ 1 (.-x p)
++ 2 (.-y p)
++ 1 (. p -x)
++ 2 (. p -y)
++ 1 (. (java.awt.Point. 1 2) -x)
++ 2 (. (java.awt.Point. 1 2) -y)))
+
+ ; Classname/staticField
+ (are [x] (= x 2147483647)
+diff --git a/test/clojure/test_clojure/test.clj b/test/clojure/test_clojure/test.clj
+index ae30b06..9278a2c 100644
+--- a/test/clojure/test_clojure/test.clj
++++ b/test/clojure/test_clojure/test.clj
+@@ -84,6 +84,26 @@
+ #_(deftest can-test-unbound-function
+ (is (does-not-exist) "Should error"))
+
++;; Test that are throws if too few/many values are given
++;;
++;; FIXME: This testcase works fine when executing it from a REPL. However, it
++;; fails when being run by ant. Why is that?
++#_(deftest are-throws-on-arity-mismatch
++ ;; No args at all
++ (is (thrown? IllegalArgumentException
++ (macroexpand-1 '(are [a] (constantly true))))
++ "Should error")
++ ;; Too many
++ (is (thrown? IllegalArgumentException
++ (macroexpand-1 '(are [a b] (constantly true)
++ 1 2 3)))
++ "Should error")
++ ;; Too few
++ (is (thrown? IllegalArgumentException
++ (macroexpand-1 '(are [a b c] (constantly true)
++ 1 2)))
++ "Should error"))
++
+
+ ;; Here, we create an alternate version of test/report, that
+ ;; compares the event with the message, then calls the original
+--
+1.7.8.4
+
View
28 patches/0002-report-load-exceptions-with-file-and-line.diff
@@ -0,0 +1,28 @@
+From 4f0b299d2ae2e9346a47dda25dfc3ee74d00e65f Mon Sep 17 00:00:00 2001
+From: Hugo Duncan <hugo@hugoduncan.org>
+Date: Fri, 24 Feb 2012 13:00:23 -0500
+Subject: [PATCH] Report Exceptions thrown in load with file and line number
+
+Fixes #15
+---
+ src/jvm/clojure/lang/Compiler.java | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
+index d41624d..f7d624f 100644
+--- a/src/jvm/clojure/lang/Compiler.java
++++ b/src/jvm/clojure/lang/Compiler.java
+@@ -6907,6 +6907,10 @@ public static Object load(Reader rdr, String sourcePath, String sourceName) {
+ {
+ throw new CompilerException(sourcePath, e.line, e.getCause());
+ }
++ catch(Exception e)
++ {
++ throw new CompilerException(sourcePath, (Integer)LINE_BEFORE.deref(), e);
++ }
+ finally
+ {
+ Var.popThreadBindings();
+--
+1.7.7.3
+
View
218 patches/CLJ-753-870-905-combined-fix3.patch
@@ -0,0 +1,218 @@
+From dbf9e2de825979c899f9551fcc5efe89f4831f5f Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Tue, 28 Feb 2012 10:15:06 -0800
+Subject: [PATCH] Fix for CLJ-753, CLJ-870, and CLJ-905.
+
+---
+ src/clj/clojure/string.clj | 86 ++++++++++++++++++++++++++-------
+ test/clojure/test_clojure/string.clj | 30 +++++++++++-
+ 2 files changed, 94 insertions(+), 22 deletions(-)
+
+diff --git a/src/clj/clojure/string.clj b/src/clj/clojure/string.clj
+index 188b518..ea59cf7 100644
+--- a/src/clj/clojure/string.clj
++++ b/src/clj/clojure/string.clj
+@@ -36,11 +36,11 @@ Design notes for clojure.string:
+ general than String. In ordinary usage you will almost always
+ pass concrete strings. If you are doing something unusual,
+ e.g. passing a mutable implementation of CharSequence, then
+- thead-safety is your responsibility."
++ thread-safety is your responsibility."
+ :author "Stuart Sierra, Stuart Halloway, David Liebke"}
+ clojure.string
+ (:refer-clojure :exclude (replace reverse))
+- (:import (java.util.regex Pattern)
++ (:import (java.util.regex Pattern Matcher)
+ clojure.lang.LazilyPersistentVector))
+
+ (defn ^String reverse
+@@ -49,16 +49,26 @@ Design notes for clojure.string:
+ [^CharSequence s]
+ (.toString (.reverse (StringBuilder. s))))
+
++(defn ^String re-qr
++ "Given a replacement string that you wish to be a literal
++ replacement for a pattern match in replace or replace-first, do the
++ necessary escaping of special characters in the replacement."
++ {:added "1.4"}
++ [^CharSequence replacement]
++ (Matcher/quoteReplacement (.toString ^CharSequence replacement)))
++
+ (defn- replace-by
+ [^CharSequence s re f]
+ (let [m (re-matcher re s)]
+- (let [buffer (StringBuffer. (.length s))]
+- (loop []
+- (if (.find m)
+- (do (.appendReplacement m buffer (f (re-groups m)))
+- (recur))
+- (do (.appendTail m buffer)
+- (.toString buffer)))))))
++ (if (.find m)
++ (let [buffer (StringBuffer. (.length s))]
++ (loop [found true]
++ (if found
++ (do (.appendReplacement m buffer (Matcher/quoteReplacement (f (re-groups m))))
++ (recur (.find m)))
++ (do (.appendTail m buffer)
++ (.toString buffer)))))
++ s)))
+
+ (defn ^String replace
+ "Replaces all instance of match with replacement in s.
+@@ -69,7 +79,21 @@ Design notes for clojure.string:
+ char / char
+ pattern / (string or function of match).
+
+- See also replace-first."
++ See also replace-first.
++
++ The replacement is literal (i.e. none of its characters are treated
++ specially) for all cases above except pattern / string.
++
++ For pattern / string, $1, $2, etc. in the replacement string are
++ substituted with the string that matched the corresponding
++ parenthesized group in the pattern. If you wish your replacement
++ string r to be used literally, use (re-qr r) as the replacement
++ argument. See also documentation for java.util.regex.Matcher's
++ appendReplacement method.
++
++ Example:
++ (clojure.string/replace \"Almost Pig Latin\" #\"\\b(\\w)(\\w+)\\b\" \"$2$1ay\")
++ -> \"lmostAay igPay atinLay\""
+ {:added "1.2"}
+ [^CharSequence s match replacement]
+ (let [s (.toString s)]
+@@ -85,12 +109,13 @@ Design notes for clojure.string:
+ (defn- replace-first-by
+ [^CharSequence s ^Pattern re f]
+ (let [m (re-matcher re s)]
+- (let [buffer (StringBuffer. (.length s))]
+- (if (.find m)
+- (let [rep (f (re-groups m))]
+- (.appendReplacement m buffer rep)
+- (.appendTail m buffer)
+- (str buffer))))))
++ (if (.find m)
++ (let [buffer (StringBuffer. (.length s))
++ rep (Matcher/quoteReplacement (f (re-groups m)))]
++ (.appendReplacement m buffer rep)
++ (.appendTail m buffer)
++ (str buffer))
++ s)))
+
+ (defn- replace-first-char
+ [^CharSequence s ^Character match replace]
+@@ -100,6 +125,14 @@ Design notes for clojure.string:
+ s
+ (str (subs s 0 i) replace (subs s (inc i))))))
+
++(defn- replace-first-str
++ [^CharSequence s ^String match ^String replace]
++ (let [^String s (.toString s)
++ i (.indexOf s match)]
++ (if (= -1 i)
++ s
++ (str (subs s 0 i) replace (subs s (+ i (.length match)))))))
++
+ (defn ^String replace-first
+ "Replaces the first instance of match with replacement in s.
+
+@@ -109,7 +142,22 @@ Design notes for clojure.string:
+ string / string
+ pattern / (string or function of match).
+
+- See also replace-all."
++ See also replace.
++
++ The replacement is literal (i.e. none of its characters are treated
++ specially) for all cases above except pattern / string.
++
++ For pattern / string, $1, $2, etc. in the replacement string are
++ substituted with the string that matched the corresponding
++ parenthesized group in the pattern. If you wish your replacement
++ string r to be used literally, use (re-qr r) as the replacement
++ argument. See also documentation for java.util.regex.Matcher's
++ appendReplacement method.
++
++ Example:
++ (clojure.string/replace-first \"swap first two words\"
++ #\"(\\w+)(\\s+)(\\w+)\" \"$3$2$1\")
++ -> \"first swap two words\""
+ {:added "1.2"}
+ [^CharSequence s match replacement]
+ (let [s (.toString s)]
+@@ -117,8 +165,8 @@ Design notes for clojure.string:
+ (instance? Character match)
+ (replace-first-char s match replacement)
+ (instance? CharSequence match)
+- (.replaceFirst s (Pattern/quote (.toString ^CharSequence match))
+- (.toString ^CharSequence replacement))
++ (replace-first-str s (.toString ^CharSequence match)
++ (.toString ^CharSequence replacement))
+ (instance? Pattern match)
+ (if (instance? CharSequence replacement)
+ (.replaceFirst (re-matcher ^Pattern match s)
+diff --git a/test/clojure/test_clojure/string.clj b/test/clojure/test_clojure/string.clj
+index d6f6469..a712413 100644
+--- a/test/clojure/test_clojure/string.clj
++++ b/test/clojure/test_clojure/string.clj
+@@ -12,14 +12,36 @@
+
+ (deftest t-replace
+ (is (= "faabar" (s/replace "foobar" \o \a)))
++ (is (= "foobar" (s/replace "foobar" \z \a)))
+ (is (= "barbarbar" (s/replace "foobarfoo" "foo" "bar")))
+- (is (= "FOObarFOO" (s/replace "foobarfoo" #"foo" s/upper-case))))
++ (is (= "foobarfoo" (s/replace "foobarfoo" "baz" "bar")))
++ (is (= "f$$d" (s/replace "food" "o" "$")))
++ (is (= "f\\\\d" (s/replace "food" "o" "\\")))
++ (is (= "barbarbar" (s/replace "foobarfoo" #"foo" "bar")))
++ (is (= "foobarfoo" (s/replace "foobarfoo" #"baz" "bar")))
++ (is (= "f$$d" (s/replace "food" #"o" (s/re-qr "$"))))
++ (is (= "f\\\\d" (s/replace "food" #"o" (s/re-qr "\\"))))
++ (is (= "FOObarFOO" (s/replace "foobarfoo" #"foo" s/upper-case)))
++ (is (= "foobarfoo" (s/replace "foobarfoo" #"baz" s/upper-case)))
++ (is (= "OObarOO" (s/replace "foobarfoo" #"f(o+)" (fn [[m g1]] (s/upper-case g1)))))
++ (is (= "baz\\bang\\" (s/replace "bazslashbangslash" #"slash" (constantly "\\")))))
+
+ (deftest t-replace-first
++ (is (= "faobar" (s/replace-first "foobar" \o \a)))
++ (is (= "foobar" (s/replace-first "foobar" \z \a)))
++ (is (= "z.ology" (s/replace-first "zoology" \o \.)))
+ (is (= "barbarfoo" (s/replace-first "foobarfoo" "foo" "bar")))
++ (is (= "foobarfoo" (s/replace-first "foobarfoo" "baz" "bar")))
++ (is (= "f$od" (s/replace-first "food" "o" "$")))
++ (is (= "f\\od" (s/replace-first "food" "o" "\\")))
+ (is (= "barbarfoo" (s/replace-first "foobarfoo" #"foo" "bar")))
+- (is (= "z.ology" (s/replace-first "zoology" \o \.)))
+- (is (= "FOObarfoo" (s/replace-first "foobarfoo" #"foo" s/upper-case))))
++ (is (= "foobarfoo" (s/replace-first "foobarfoo" #"baz" "bar")))
++ (is (= "f$od" (s/replace-first "food" #"o" (s/re-qr "$"))))
++ (is (= "f\\od" (s/replace-first "food" #"o" (s/re-qr "\\"))))
++ (is (= "FOObarfoo" (s/replace-first "foobarfoo" #"foo" s/upper-case)))
++ (is (= "foobarfoo" (s/replace-first "foobarfoo" #"baz" s/upper-case)))
++ (is (= "OObarfoo" (s/replace-first "foobarfoo" #"f(o+)" (fn [[m g1]] (s/upper-case g1)))))
++ (is (= "baz\\bangslash" (s/replace-first "bazslashbangslash" #"slash" (constantly "\\")))))
+
+ (deftest t-join
+ (are [x coll] (= x (s/join coll))
+@@ -65,6 +87,7 @@
+ s/reverse [nil]
+ s/replace [nil #"foo" "bar"]
+ s/replace-first [nil #"foo" "bar"]
++ s/re-qr [nil]
+ s/capitalize [nil]
+ s/upper-case [nil]
+ s/lower-case [nil]
+@@ -85,6 +108,7 @@
+ "baz::quux" s/replace-first ["baz--quux" #"--" "::"]
+ "baz::quux" s/replace-first ["baz--quux" (StringBuffer. "--") (StringBuffer. "::")]
+ "zim-zam" s/replace-first ["zim zam" #" " (StringBuffer. "-")]
++ "\\\\ \\$" s/re-qr ["\\ $"]
+ "Pow" s/capitalize ["POW"]
+ "BOOM" s/upper-case ["boom"]
+ "whimper" s/lower-case ["whimPER"]
+--
+1.7.3.4
+
View
177 patches/CLJ-768-patch-for-after-CLJ-881-fixed.patch
@@ -0,0 +1,177 @@
+From f0ee736d5ff0fe7eba08df1d5352204d009d2f9e Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Mon, 13 Feb 2012 19:42:35 -0800
+Subject: [PATCH] Fixes for CLJ-768 and other problems found with cl-format ~f
+ directive
+
+Without the changes to cl_format.clj, 46 of the 72 new unit tests
+added to test_cl_format.clj fail.
+---
+ src/clj/clojure/pprint/cl_format.clj | 41 +++++++++--
+ .../clojure/test_clojure/pprint/test_cl_format.clj | 72 ++++++++++++++++++++
+ 2 files changed, 105 insertions(+), 8 deletions(-)
+
+diff --git a/src/clj/clojure/pprint/cl_format.clj b/src/clj/clojure/pprint/cl_format.clj
+index 74cd33b..246b65d 100644
+--- a/src/clj/clojure/pprint/cl_format.clj
++++ b/src/clj/clojure/pprint/cl_format.clj
+@@ -583,11 +583,24 @@ string, or one character longer."
+ (defn- round-str [m e d w]
+ (if (or d w)
+ (let [len (count m)
+- round-pos (if d (+ e d 1))
+- round-pos (if (and w (< (inc e) (dec w))
+- (or (nil? round-pos) (< (dec w) round-pos)))
+- (dec w)
+- round-pos)
++ ;; Every formatted floating point number should include at
++ ;; least one decimal digit and a decimal point.
++ w (if w (max 2 w))
++ round-pos (cond
++ ;; If d was given, that forces the rounding
++ ;; position, regardless of any width that may
++ ;; have been specified.
++ d (+ e d 1)
++ ;; Otherwise w was specified, so pick round-pos
++ ;; based upon that.
++ ;; If e>=0, then abs value of number is >= 1.0,
++ ;; and e+1 is number of decimal digits before the
++ ;; decimal point when the number is written
++ ;; without scientific notation. Never round the
++ ;; number before the decimal point.
++ (>= e 0) (max (inc e) (dec w))
++ ;; e < 0, so number abs value < 1.0
++ :else (+ w e))
+ [m1 e1 round-pos len] (if (= round-pos 0)
+ [(str "0" m) (inc e) 1 (inc len)]
+ [m e round-pos len])]
+@@ -600,16 +613,21 @@ string, or one character longer."
+ (if (>= (int round-char) (int \5))
+ (let [round-up-result (inc-s result)
+ expanded (> (count round-up-result) (count result))]
+- [round-up-result e1 expanded])
++ [(if expanded
++ (subs round-up-result 0 (dec (count round-up-result)))
++ round-up-result)
++ e1 expanded])
+ [result e1 false]))
+ [m e false]))
+ [m e false]))
+ [m e false]))
+
+ (defn- expand-fixed [m e d]
+- (let [m1 (if (neg? e) (str (apply str (repeat (dec (- e)) \0)) m) m)
++ (let [[m1 e1] (if (neg? e)
++ [(str (apply str (repeat (dec (- e)) \0)) m) -1]
++ [m e])
+ len (count m1)
+- target-len (if d (+ e d 1) (inc e))]
++ target-len (if d (+ e1 d 1) (inc e1))]
+ (if (< len target-len)
+ (str m1 (apply str (repeat (- target-len len) \0)))
+ m1)))
+@@ -646,6 +664,13 @@ string, or one character longer."
+ [rounded-mantissa scaled-exp expanded] (round-str mantissa scaled-exp
+ d (if w (- w (if add-sign 1 0))))
+ fixed-repr (get-fixed rounded-mantissa (if expanded (inc scaled-exp) scaled-exp) d)
++ fixed-repr (if (and w d
++ (>= d 1)
++ (= (.charAt fixed-repr 0) \0)
++ (= (.charAt fixed-repr 1) \.)
++ (> (count fixed-repr) (- w (if add-sign 1 0))))
++ (subs fixed-repr 1) ; chop off leading 0
++ fixed-repr)
+ prepend-zero (= (first fixed-repr) \.)]
+ (if w
+ (let [len (count fixed-repr)
+diff --git a/test/clojure/test_clojure/pprint/test_cl_format.clj b/test/clojure/test_clojure/pprint/test_cl_format.clj
+index eda2305..990d3d5 100644
+--- a/test/clojure/test_clojure/pprint/test_cl_format.clj
++++ b/test/clojure/test_clojure/pprint/test_cl_format.clj
+@@ -205,11 +205,83 @@
+ (cl-format nil "~,1f" 0.99) "1.0"
+ (cl-format nil "~,2f" 0.99) "0.99"
+ (cl-format nil "~,3f" 0.99) "0.990"
++ (cl-format nil "~,3f" -0.099) "-0.099"
++ (cl-format nil "~,4f" -0.099) "-0.0990"
++ (cl-format nil "~,5f" -0.099) "-0.09900"
++ (cl-format nil "~,3f" 0.099) "0.099"
++ (cl-format nil "~,4f" 0.099) "0.0990"
++ (cl-format nil "~,5f" 0.099) "0.09900"
+ (cl-format nil "~f" -1) "-1.0"
+ (cl-format nil "~2f" -1) "-1."
+ (cl-format nil "~3f" -1) "-1."
+ (cl-format nil "~4f" -1) "-1.0"
+ (cl-format nil "~8f" -1) " -1.0"
++ (cl-format nil "~2f" -0.0099) "-0."
++ (cl-format nil "~3f" -0.0099) "-0."
++ (cl-format nil "~4f" -0.0099) "-.01"
++ (cl-format nil "~5f" -0.0099) "-0.01"
++ (cl-format nil "~6f" -0.0099) "-.0099"
++ (cl-format nil "~1f" 0.0099) "0."
++ (cl-format nil "~2f" 0.0099) "0."
++ (cl-format nil "~3f" 0.0099) ".01"
++ (cl-format nil "~4f" 0.0099) "0.01"
++ (cl-format nil "~5f" 0.0099) ".0099"
++ (cl-format nil "~6f" 0.0099) "0.0099"
++ (cl-format nil "~1f" -0.099) "-.1"
++ (cl-format nil "~2f" -0.099) "-.1"
++ (cl-format nil "~3f" -0.099) "-.1"
++ (cl-format nil "~4f" -0.099) "-0.1"
++ (cl-format nil "~5f" -0.099) "-.099"
++ (cl-format nil "~6f" -0.099) "-0.099"
++ (cl-format nil "~1f" 0.099) ".1"
++ (cl-format nil "~2f" 0.099) ".1"
++ (cl-format nil "~3f" 0.099) "0.1"
++ (cl-format nil "~4f" 0.099) ".099"
++ (cl-format nil "~5f" 0.099) "0.099"
++ (cl-format nil "~1f" -0.99) "-1."
++ (cl-format nil "~2f" -0.99) "-1."
++ (cl-format nil "~3f" -0.99) "-1."
++ (cl-format nil "~4f" -0.99) "-.99"
++ (cl-format nil "~5f" -0.99) "-0.99"
++ (cl-format nil "~1f" 0.99) "1."
++ (cl-format nil "~2f" 0.99) "1."
++ (cl-format nil "~3f" 0.99) ".99"
++ (cl-format nil "~4f" 0.99) "0.99"
++ (cl-format nil "~1f" 111.11111) "111."
++ (cl-format nil "~4f" 111.11111) "111."
++ (cl-format nil "~5f" 111.11111) "111.1"
++ (cl-format nil "~1f" -111.11111) "-111."
++ (cl-format nil "~5f" -111.11111) "-111."
++ (cl-format nil "~6f" -111.11111) "-111.1"
++ (cl-format nil "~1f" 555.55555) "556."
++ (cl-format nil "~4f" 555.55555) "556."
++ (cl-format nil "~5f" 555.55555) "555.6"
++ (cl-format nil "~8f" 555.55555) "555.5556"
++ (cl-format nil "~1f" -555.55555) "-556."
++ (cl-format nil "~5f" -555.55555) "-556."
++ (cl-format nil "~6f" -555.55555) "-555.6"
++ (cl-format nil "~8f" -555.55555) "-555.556"
++ (cl-format nil "~1f" 999.999) "1000."
++ (cl-format nil "~5f" 999.999) "1000."
++ (cl-format nil "~6f" 999.999) "1000.0"
++ (cl-format nil "~7f" 999.999) "999.999"
++ (cl-format nil "~8f" 999.999) " 999.999"
++ (cl-format nil "~1f" -999.999) "-1000."
++ (cl-format nil "~6f" -999.999) "-1000."
++ (cl-format nil "~7f" -999.999) "-1000.0"
++ (cl-format nil "~8f" -999.999) "-999.999"
++ (cl-format nil "~5,2f" 111.11111) "111.11"
++ (cl-format nil "~3,1f" -0.0099) "-.0"
++ (cl-format nil "~6,4f" -0.0099) "-.0099"
++ (cl-format nil "~6,5f" -0.0099) "-.00990"
++ (cl-format nil "~6,6f" -0.0099) "-.009900"
++ (cl-format nil "~6,4f" 0.0099) "0.0099"
++ (cl-format nil "~6,5f" 0.0099) ".00990"
++ (cl-format nil "~6,6f" 0.0099) ".009900"
++ (cl-format nil "~2,1f" 0.0099) ".0"
++ (cl-format nil "~6,2f" -111.11111) "-111.11"
++ (cl-format nil "~6,3f" -111.11111) "-111.111"
++ (cl-format nil "~8,5f" -111.11111) "-111.11111"
+ (cl-format nil "~12,10f" 1.00000000074) "1.0000000007"
+ (cl-format nil "~12,10f" 1.00000000076) "1.0000000008"
+ (cl-format nil "~13,10f" -1.00000000074) "-1.0000000007"
+--
+1.7.7.4
+
View
773 patches/CLJ-855-sneaky-throw.patch
@@ -1,773 +0,0 @@
-From 4669bf98656947e421c9662f3e915ae6fdad8224 Mon Sep 17 00:00:00 2001
-From: Paul M Bauer <paul.michael.bauer@gmail.com>
-Date: Tue, 11 Oct 2011 18:29:58 -0700
-Subject: [PATCH 1/4] Added regression test for catching checked exceptions.
-
----
- src/script/run_tests.clj | 1 +
- test/clojure/test_clojure/try_catch.clj | 24 ++++++++++++++++++++++++
- 2 files changed, 25 insertions(+), 0 deletions(-)
- mode change 100644 => 100755 src/script/run_tests.clj
- create mode 100755 test/clojure/test_clojure/try_catch.clj
-
-diff --git a/src/script/run_tests.clj b/src/script/run_tests.clj
-old mode 100644
-new mode 100755
-index 6720abd..1aa8b99
---- a/src/script/run_tests.clj
-+++ b/src/script/run_tests.clj
-@@ -50,6 +50,7 @@ clojure.test-clojure.string
- clojure.test-clojure.test
- clojure.test-clojure.test-fixtures
- clojure.test-clojure.transients
-+clojure.test-clojure.try-catch
- clojure.test-clojure.vars
- clojure.test-clojure.vectors
- ])
-diff --git a/test/clojure/test_clojure/try_catch.clj b/test/clojure/test_clojure/try_catch.clj
-new file mode 100755
-index 0000000..e53eb0b
---- /dev/null
-+++ b/test/clojure/test_clojure/try_catch.clj
-@@ -0,0 +1,24 @@
-+; Copyright (c) Rich Hickey. All rights reserved.
-+; The use and distribution terms for this software are covered by the
-+; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-+; which can be found in the file epl-v10.html at the root of this distribution.
-+; By using this software in any fashion, you are agreeing to be bound by
-+; the terms of this license.
-+; You must not remove this notice, or any other, from this software.
-+
-+; Author: Paul M Bauer
-+
-+(ns clojure.test-clojure.try-catch
-+ (:use clojure.test))
-+
-+(defn- get-exception [expression]
-+ (try (eval expression)
-+ nil
-+ (catch java.lang.Throwable t
-+ t)))
-+
-+(deftest catch-receives-checked-exception
-+ (are [expression expected-exception] (= expected-exception
-+ (type (get-exception expression)))
-+ "Eh, I'm pretty safe" nil
-+ '(java.io.FileReader. "CAFEBABEx0/idonotexist") java.io.FileNotFoundException))
---
-1.7.6.1
-
-
-From 0e917344dd7529a7519afe0dd988818fe9b19728 Mon Sep 17 00:00:00 2001
-From: Ben Smith-Mannschott <bsmith.occs@gmail.com>
-Date: Thu, 13 Oct 2011 21:01:55 +0200
-Subject: [PATCH 2/4] CLJ-855: add test that goes through Reflector
-
-(The existing test produces the same wrapped exception symptom,
-but does so by going through eval.)
----
- src/jvm/clojure/test/ReflectorTryCatchFixture.java | 17 +++++++++++++++++
- test/clojure/test_clojure/try_catch.clj | 15 +++++++++++++--
- 2 files changed, 30 insertions(+), 2 deletions(-)
- create mode 100644 src/jvm/clojure/test/ReflectorTryCatchFixture.java
-
-diff --git a/src/jvm/clojure/test/ReflectorTryCatchFixture.java b/src/jvm/clojure/test/ReflectorTryCatchFixture.java
-new file mode 100644
-index 0000000..9256559
---- /dev/null
-+++ b/src/jvm/clojure/test/ReflectorTryCatchFixture.java
-@@ -0,0 +1,17 @@
-+package clojure.test;
-+
-+public class ReflectorTryCatchFixture {
-+
-+ public static void fail(Long x) throws Cookies {
-+ throw new Cookies("Long");
-+ }
-+
-+ public static void fail(Double y) throws Cookies {
-+ throw new Cookies("Double");
-+ }
-+
-+ public static class Cookies extends Exception {
-+ public Cookies(String msg) { super(msg); }
-+ }
-+
-+}
-diff --git a/test/clojure/test_clojure/try_catch.clj b/test/clojure/test_clojure/try_catch.clj
-index e53eb0b..328495a 100755
---- a/test/clojure/test_clojure/try_catch.clj
-+++ b/test/clojure/test_clojure/try_catch.clj
-@@ -9,7 +9,9 @@
- ; Author: Paul M Bauer
-
- (ns clojure.test-clojure.try-catch
-- (:use clojure.test))
-+ (:use clojure.test)
-+ (:import [clojure.test ReflectorTryCatchFixture
-+ ReflectorTryCatchFixture$Cookies]))
-
- (defn- get-exception [expression]
- (try (eval expression)
-@@ -17,8 +19,17 @@
- (catch java.lang.Throwable t
- t)))
-
--(deftest catch-receives-checked-exception
-+(deftest catch-receives-checked-exception-from-eval
- (are [expression expected-exception] (= expected-exception
- (type (get-exception expression)))
- "Eh, I'm pretty safe" nil
- '(java.io.FileReader. "CAFEBABEx0/idonotexist") java.io.FileNotFoundException))
-+
-+
-+(defn fail [x]
-+ (ReflectorTryCatchFixture/fail x))
-+
-+(deftest catch-receives-checked-exception-from-reflective-call
-+ (is (thrown-with-msg? ReflectorTryCatchFixture$Cookies #"Long" (fail 1)))
-+ (is (thrown-with-msg? ReflectorTryCatchFixture$Cookies #"Double" (fail 1.0))))
-+
---
-1.7.6.1
-
-
-From 230834a8f46f5f2a76852ccede7e03bcabe12a97 Mon Sep 17 00:00:00 2001
-From: Ben Smith-Mannschott <bsmith.occs@gmail.com>
-Date: Fri, 14 Oct 2011 20:05:29 +0200
-Subject: [PATCH 3/4] CLJ-855: Util.sneakyThrow() throws any exception without
- being required to declare or catch it
-
----
- src/jvm/clojure/lang/Util.java | 20 ++++++++++++++++++++
- 1 files changed, 20 insertions(+), 0 deletions(-)
-
-diff --git a/src/jvm/clojure/lang/Util.java b/src/jvm/clojure/lang/Util.java
-index 1fc0439..d751e82 100644
---- a/src/jvm/clojure/lang/Util.java
-+++ b/src/jvm/clojure/lang/Util.java
-@@ -169,4 +169,24 @@ static public RuntimeException runtimeException(Throwable e){
- return new RuntimeException(e);
- }
-
-+/**
-+ * Throw even checked exceptions without being required
-+ * to declare them or catch them. Suggested idiom:
-+ * <p>
-+ * <code>throw sneakyThrow( some exception );</code>
-+ */
-+static public RuntimeException sneakyThrow(Throwable t) {
-+ // http://www.mail-archive.com/javaposse@googlegroups.com/msg05984.html
-+ if (t == null)
-+ throw new NullPointerException();
-+ Util.<RuntimeException>sneakyThrow0(t);
-+ return null;
-+}
-+
-+@SuppressWarnings("unchecked")
-+static private <T extends Throwable> void sneakyThrow0(Throwable t) throws T {
-+ throw (T) t;
- }
-+
-+}
-+
---
-1.7.6.1
-
-
-From 89c6756b6a5cb5cb99b61b31783a6e3cd5589c81 Mon Sep 17 00:00:00 2001
-From: Ben Smith-Mannschott <bsmith.occs@gmail.com>
-Date: Fri, 14 Oct 2011 20:18:45 +0200
-Subject: [PATCH 4/4] CLJ-855: throw exceptions directly instead of wrapping
- them with RTE
-
----
- src/jvm/clojure/lang/AFn.java | 2 +-
- src/jvm/clojure/lang/AFunction.java | 2 +-
- src/jvm/clojure/lang/AMapEntry.java | 2 +-
- src/jvm/clojure/lang/ARef.java | 6 +-
- src/jvm/clojure/lang/Compiler.java | 32 ++++++++--------
- src/jvm/clojure/lang/FnLoaderThunk.java | 2 +-
- src/jvm/clojure/lang/LazySeq.java | 2 +-
- src/jvm/clojure/lang/LispReader.java | 6 +-
- src/jvm/clojure/lang/PersistentHashMap.java | 2 +-
- src/jvm/clojure/lang/RT.java | 10 ++--
- src/jvm/clojure/lang/Ref.java | 2 +-
- src/jvm/clojure/lang/Reflector.java | 48 +++++++++++-------------
- src/jvm/clojure/lang/TransactionalHashMap.java | 4 +-
- src/jvm/clojure/lang/Util.java | 7 +---
- src/jvm/clojure/lang/Var.java | 13 ++++--
- 15 files changed, 67 insertions(+), 73 deletions(-)
-
-diff --git a/src/jvm/clojure/lang/AFn.java b/src/jvm/clojure/lang/AFn.java
-index f2d530a..ca4d39d 100644
---- a/src/jvm/clojure/lang/AFn.java
-+++ b/src/jvm/clojure/lang/AFn.java
-@@ -25,7 +25,7 @@ public void run(){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-diff --git a/src/jvm/clojure/lang/AFunction.java b/src/jvm/clojure/lang/AFunction.java
-index d797102..2963d0e 100644
---- a/src/jvm/clojure/lang/AFunction.java
-+++ b/src/jvm/clojure/lang/AFunction.java
-@@ -60,7 +60,7 @@ public int compare(Object o1, Object o2){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- }
-diff --git a/src/jvm/clojure/lang/AMapEntry.java b/src/jvm/clojure/lang/AMapEntry.java
-index f9e0246..41ae756 100644
---- a/src/jvm/clojure/lang/AMapEntry.java
-+++ b/src/jvm/clojure/lang/AMapEntry.java
-@@ -78,7 +78,7 @@ public String toString(){
- catch(Exception e)
- {
- //checked exceptions stink!
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return sw.toString();
- }
-diff --git a/src/jvm/clojure/lang/ARef.java b/src/jvm/clojure/lang/ARef.java
-index e9235c0..44dc2ad 100644
---- a/src/jvm/clojure/lang/ARef.java
-+++ b/src/jvm/clojure/lang/ARef.java
-@@ -53,7 +53,7 @@ public void setValidator(IFn vf){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- validator = vf;
- }
-@@ -78,7 +78,7 @@ synchronized public IRef removeWatch(Object key){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
-
- return this;
-@@ -99,7 +99,7 @@ public void notifyWatches(Object oldval, Object newval){
- }
- catch(Exception e1)
- {
-- throw Util.runtimeException(e1);
-+ throw Util.sneakyThrow(e1);
- }
- }
- }
-diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
-index 55e1268..1e2efdd 100644
---- a/src/jvm/clojure/lang/Compiler.java
-+++ b/src/jvm/clojure/lang/Compiler.java
-@@ -1136,7 +1136,7 @@ static class StaticFieldExpr extends FieldExpr implements AssignableExpr{
- }
- catch(NoSuchFieldException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- this.tag = tag;
- }
-@@ -1209,7 +1209,7 @@ static Class maybePrimitiveType(Expr e){
- }
- catch(Exception ex)
- {
-- throw Util.runtimeException(ex);
-+ throw Util.sneakyThrow(ex);
- }
- return null;
- }
-@@ -2402,7 +2402,7 @@ public static class NewExpr implements Expr{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- return Reflector.invokeConstructor(c, argvals);
-@@ -2560,7 +2560,7 @@ public static class IfExpr implements Expr, MaybePrimitiveExpr{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- if(emitUnboxed)
- ((MaybePrimitiveExpr)thenExpr).emitUnboxed(context, objx, gen);
-@@ -3198,7 +3198,7 @@ static class StaticInvokeExpr implements Expr, MaybePrimitiveExpr{
- }
- catch(Exception ex)
- {
-- throw Util.runtimeException(ex);
-+ throw Util.sneakyThrow(ex);
- }
- }
- IPersistentVector restArgs = RT.subvec(args,paramclasses.length - 1,args.count());
-@@ -3720,7 +3720,7 @@ static public class FnExpr extends ObjExpr{
- }
- catch(IOException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- fn.getCompiledClass();
-
-@@ -4563,7 +4563,7 @@ static public class ObjExpr implements Expr{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return compiledClass;
- }
-@@ -4577,7 +4577,7 @@ static public class ObjExpr implements Expr{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -5077,7 +5077,7 @@ public static class FnMethod extends ObjMethod{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- finally
- {
-@@ -5141,7 +5141,7 @@ public static class FnMethod extends ObjMethod{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- finally
- {
-@@ -6082,7 +6082,7 @@ public static class RecurExpr implements Expr{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- else
-@@ -6501,7 +6501,7 @@ public static Object eval(Object form, boolean freshLoader) {
- catch(Throwable e)
- {
- if(!(e instanceof RuntimeException))
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- throw (RuntimeException)e;
- }
- finally
-@@ -6607,7 +6607,7 @@ static void addAnnotation(Object visitor, IPersistentMap meta){
- }
- catch (Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -6618,7 +6618,7 @@ static void addParameterAnnotation(Object visitor, IPersistentMap meta, int i){
- }
- catch (Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -7348,7 +7348,7 @@ static public class NewInstanceExpr extends ObjExpr{
- }
- catch(IOException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- ret.getCompiledClass();
- return ret;
-@@ -7858,7 +7858,7 @@ public static class NewInstanceMethod extends ObjMethod{
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- finally
- {
-diff --git a/src/jvm/clojure/lang/FnLoaderThunk.java b/src/jvm/clojure/lang/FnLoaderThunk.java
-index 1c5f2b7..337ba25 100644
---- a/src/jvm/clojure/lang/FnLoaderThunk.java
-+++ b/src/jvm/clojure/lang/FnLoaderThunk.java
-@@ -55,7 +55,7 @@ private void load() {
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- v.root = fn;
- }
-diff --git a/src/jvm/clojure/lang/LazySeq.java b/src/jvm/clojure/lang/LazySeq.java
-index 41e9dfe..4a40c5a 100644
---- a/src/jvm/clojure/lang/LazySeq.java
-+++ b/src/jvm/clojure/lang/LazySeq.java
-@@ -48,7 +48,7 @@ final synchronized Object sval(){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- if(sv != null)
-diff --git a/src/jvm/clojure/lang/LispReader.java b/src/jvm/clojure/lang/LispReader.java
-index dbb59a6..eb6d0b2 100644
---- a/src/jvm/clojure/lang/LispReader.java
-+++ b/src/jvm/clojure/lang/LispReader.java
-@@ -123,7 +123,7 @@ static void unread(PushbackReader r, int ch) {
- }
- catch(IOException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -143,7 +143,7 @@ static public int read1(Reader r){
- }
- catch(IOException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -209,7 +209,7 @@ static public Object read(PushbackReader r, boolean eofIsError, Object eofValue,
- catch(Exception e)
- {
- if(isRecursive || !(r instanceof LineNumberingPushbackReader))
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- LineNumberingPushbackReader rdr = (LineNumberingPushbackReader) r;
- //throw Util.runtimeException(String.format("ReaderError:(%d,1) %s", rdr.getLineNumber(), e.getMessage()), e);
- throw new ReaderException(rdr.getLineNumber(), e);
-diff --git a/src/jvm/clojure/lang/PersistentHashMap.java b/src/jvm/clojure/lang/PersistentHashMap.java
-index 18a7531..60a1926 100644
---- a/src/jvm/clojure/lang/PersistentHashMap.java
-+++ b/src/jvm/clojure/lang/PersistentHashMap.java
-@@ -1053,4 +1053,4 @@ static final class NodeSeq extends ASeq {
- }
- }
-
--}
-\ No newline at end of file
-+}
-diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
-index 81ca178..c757656 100644
---- a/src/jvm/clojure/lang/RT.java
-+++ b/src/jvm/clojure/lang/RT.java
-@@ -306,7 +306,7 @@ static{
- }
- catch(IOException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- });
-@@ -316,7 +316,7 @@ static{
- doInit();
- }
- catch(Exception e) {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -1671,7 +1671,7 @@ static public String printString(Object x){
- return sw.toString();
- }
- catch(Exception e) {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -1681,7 +1681,7 @@ static public Object readString(String s){
- return LispReader.read(r, true, null, false);
- }
- catch(Exception e) {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -2014,7 +2014,7 @@ static public Class classForName(String name) {
- }
- catch(ClassNotFoundException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-diff --git a/src/jvm/clojure/lang/Ref.java b/src/jvm/clojure/lang/Ref.java
-index 9206785..cf7ffa7 100644
---- a/src/jvm/clojure/lang/Ref.java
-+++ b/src/jvm/clojure/lang/Ref.java
-@@ -247,7 +247,7 @@ public void run(){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-diff --git a/src/jvm/clojure/lang/Reflector.java b/src/jvm/clojure/lang/Reflector.java
-index a57c32b..7164994 100644
---- a/src/jvm/clojure/lang/Reflector.java
-+++ b/src/jvm/clojure/lang/Reflector.java
-@@ -31,14 +31,22 @@ public static Object invokeInstanceMethod(Object target, String methodName, Obje
- }
- catch(Exception e)
- {
-- if(e.getCause() instanceof Exception)
-- throw Util.runtimeException(e.getCause());
-- else if(e.getCause() instanceof Error)
-- throw (Error) e.getCause();
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(getCauseOrElse(e));
- }
- }
-
-+private static Throwable getCauseOrElse(Exception e) {
-+ if (e.getCause() != null)
-+ return e.getCause();
-+ return e;
-+}
-+
-+private static RuntimeException throwCauseOrElseException(Exception e) {
-+ if (e.getCause() != null)
-+ throw Util.sneakyThrow(e.getCause());
-+ throw Util.sneakyThrow(e);
-+}
-+
- private static String noMethodReport(String methodName, Object target){
- return "No matching method found: " + methodName
- + (target==null?"":" for " + target.getClass());
-@@ -93,11 +101,7 @@ static Object invokeMatchingMethod(String methodName, List methods, Object targe
- }
- catch(Exception e)
- {
-- if(e.getCause() instanceof Exception)
-- throw Util.runtimeException(e.getCause());
-- else if(e.getCause() instanceof Error)
-- throw (Error) e.getCause();
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(getCauseOrElse(e));
- }
-
- }
-@@ -189,11 +193,7 @@ public static Object invokeConstructor(Class c, Object[] args) {
- }
- catch(Exception e)
- {
-- if(e.getCause() instanceof Exception)
-- throw Util.runtimeException(e.getCause());
-- else if(e.getCause() instanceof Error)
-- throw (Error) e.getCause();
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(getCauseOrElse(e));
- }
- }
-
-@@ -210,11 +210,7 @@ public static Object invokeStaticMethod(String className, String methodName, Obj
- }
- catch(Exception e)
- {
-- if(e.getCause() instanceof Exception)
-- throw Util.runtimeException(e.getCause());
-- else if(e.getCause() instanceof Error)
-- throw (Error) e.getCause();
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(getCauseOrElse(e));
- }
- }
-
-@@ -242,7 +238,7 @@ public static Object getStaticField(Class c, String fieldName) {
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- throw new IllegalArgumentException("No matching field found: " + fieldName
-@@ -264,7 +260,7 @@ public static Object setStaticField(Class c, String fieldName, Object val) {
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return val;
- }
-@@ -283,7 +279,7 @@ public static Object getInstanceField(Object target, String fieldName) {
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- throw new IllegalArgumentException("No matching field found: " + fieldName
-@@ -301,7 +297,7 @@ public static Object setInstanceField(Object target, String fieldName, Object va
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return val;
- }
-@@ -330,7 +326,7 @@ public static Object invokeInstanceMember(Object target, String name) {
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
- return invokeInstanceMethod(target, name, RT.EMPTY_ARRAY);
-@@ -348,7 +344,7 @@ public static Object invokeInstanceMember(String name, Object target, Object arg
- }
- catch(IllegalAccessException e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return arg1;
- }
-diff --git a/src/jvm/clojure/lang/TransactionalHashMap.java b/src/jvm/clojure/lang/TransactionalHashMap.java
-index ea3f9d7..c8e3080 100644
---- a/src/jvm/clojure/lang/TransactionalHashMap.java
-+++ b/src/jvm/clojure/lang/TransactionalHashMap.java
-@@ -93,7 +93,7 @@ public V remove(Object k){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- return (V) ret;
- }
-@@ -163,7 +163,7 @@ public boolean remove(Object k, Object v){
- }
- catch(Exception ex)
- {
-- throw Util.runtimeException(ex);
-+ throw Util.sneakyThrow(ex);
- }
- return true;
- }
-diff --git a/src/jvm/clojure/lang/Util.java b/src/jvm/clojure/lang/Util.java
-index d751e82..295fe90 100644
---- a/src/jvm/clojure/lang/Util.java
-+++ b/src/jvm/clojure/lang/Util.java
-@@ -159,16 +159,11 @@ static public <K,V> void clearCache(ReferenceQueue rq, ConcurrentHashMap<K, Refe
- static public RuntimeException runtimeException(String s){
- return new RuntimeException(s);
- }
-+
- static public RuntimeException runtimeException(String s, Throwable e){
- return new RuntimeException(s, e);
- }
-
--static public RuntimeException runtimeException(Throwable e){
-- if(e instanceof RuntimeException)
-- return (RuntimeException)e;
-- return new RuntimeException(e);
--}
--
- /**
- * Throw even checked exceptions without being required
- * to declare them or catch them. Suggested idiom:
-diff --git a/src/jvm/clojure/lang/Var.java b/src/jvm/clojure/lang/Var.java
-index 3be479b..690e60b 100644
---- a/src/jvm/clojure/lang/Var.java
-+++ b/src/jvm/clojure/lang/Var.java
-@@ -240,7 +240,7 @@ public void setMacro() {
- }
- catch (Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -271,7 +271,7 @@ public void setTag(Symbol tag) {
- }
- catch (Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -291,7 +291,7 @@ synchronized public void bindRoot(Object root){
- }
- catch (Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- notifyWatches(oldroot,this.root);
- }
-@@ -389,7 +389,7 @@ public void run(){
- }
- catch(Exception e)
- {
-- throw Util.runtimeException(e);
-+ throw Util.sneakyThrow(e);
- }
- }
-
-@@ -533,7 +533,10 @@ static IFn dissoc = new AFn() {
- }
- catch(Exception e)
- {
-- return Util.runtimeException(e);
-+// TODO:CLJ-855 "throw Util.sneakyThrow(e)" instead?
-+// I don't understand why we are *returing* the exception here instead
-+// of just throwing it.
-+ return e;
- }
- }
- };
---
-1.7.6.1
-
View
68 patches/CLJ-881-patch-from-dimitrov.txt
@@ -0,0 +1,68 @@
+From 6d00a521152fa8635d5b6a74277681b475b1095f Mon Sep 17 00:00:00 2001
+From: Vyacheslav Dimitrov <vyacheslav.dimitrov@gmail.com>
+Date: Sun, 12 Feb 2012 00:21:16 -0800
+Subject: [PATCH] Fix for bug CLJ-881.
+
+---
+ src/clj/clojure/pprint/cl_format.clj | 22 +++++++++++++++----
+ .../clojure/test_clojure/pprint/test_cl_format.clj | 4 +++
+ 2 files changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/src/clj/clojure/pprint/cl_format.clj b/src/clj/clojure/pprint/cl_format.clj
+index ef5c981..74cd33b 100644
+--- a/src/clj/clojure/pprint/cl_format.clj
++++ b/src/clj/clojure/pprint/cl_format.clj
+@@ -564,6 +564,22 @@ Note this should only be used for the last one in the sequence"
+ ["0" 0]
+ [m2 (- (Integer/valueOf e) delta)])))
+
++(defn- ^String inc-s
++ "Assumption: The input string consists of one or more decimal digits,
++and no other characters. Return a string containing one or more
++decimal digits containing a decimal number one larger than the input
++string. The output string will always be the same length as the input
++string, or one character longer."
++ [^String s]
++ (let [len-1 (dec (count s))]
++ (loop [i (int len-1)]
++ (cond
++ (neg? i) (apply str "1" (repeat (inc len-1) "0"))
++ (= \9 (.charAt s i)) (recur (dec i))
++ :else (apply str (subs s 0 i)
++ (char (inc (int (.charAt s i))))
++ (repeat (- len-1 i) "0"))))))
++
+ (defn- round-str [m e d w]
+ (if (or d w)
+ (let [len (count m)
+@@ -582,11 +598,7 @@ Note this should only be used for the last one in the sequence"
+ (let [round-char (nth m1 round-pos)
+ ^String result (subs m1 0 round-pos)]
+ (if (>= (int round-char) (int \5))
+- (let [result-val (Integer/valueOf result)
+- leading-zeros (subs result 0 (min (prefix-count result \0) (- round-pos 1)))
+- round-up-result (str leading-zeros
+- (String/valueOf (+ result-val
+- (if (neg? result-val) -1 1))))
++ (let [round-up-result (inc-s result)
+ expanded (> (count round-up-result) (count result))]
+ [round-up-result e1 expanded])
+ [result e1 false]))
+diff --git a/test/clojure/test_clojure/pprint/test_cl_format.clj b/test/clojure/test_clojure/pprint/test_cl_format.clj
+index 8a95104..eda2305 100644
+--- a/test/clojure/test_clojure/pprint/test_cl_format.clj
++++ b/test/clojure/test_clojure/pprint/test_cl_format.clj
+@@ -210,6 +210,10 @@
+ (cl-format nil "~3f" -1) "-1."
+ (cl-format nil "~4f" -1) "-1.0"
+ (cl-format nil "~8f" -1) " -1.0"
++ (cl-format nil "~12,10f" 1.00000000074) "1.0000000007"
++ (cl-format nil "~12,10f" 1.00000000076) "1.0000000008"
++ (cl-format nil "~13,10f" -1.00000000074) "-1.0000000007"
++ (cl-format nil "~13,10f" -1.00000000076) "-1.0000000008"
+ (cl-format nil "~1,1f" 0.1) ".1")
+
+ (simple-tests ampersand-tests
+--
+1.7.7.4
+
View
180 patches/CLJ-886-fix2.patch
@@ -0,0 +1,180 @@
+From 3fc4b111cfa23440f6a243848e1658f34da01cf4 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <jafinger@cisco.com>
+Date: Thu, 9 Feb 2012 18:07:34 -0800
+Subject: [PATCH] Fix for CLJ-886, along with test illustrating the problem
+
+Original reported problem was with do-copy method on arg types
+InputStream and Writer. Changes to function data-fixture and test
+test-copy-encodings in clojure.java.io's test suite now cause the
+problem to occur, in the absence of this fix to do-copy.
+
+While fixing that one and adding tests, it was also discovered that
+do-copy with arg types Reader and OutputStream had a bug if the
+encoding was UTF-16, because Java's .getBytes returns a byte-order
+mark (Unicode code point U+FEFF) at the beginning of the byte array
+every time it is called. Thus if the file being copied was larger
+than one buffer's worth of data, a new byte-order mark was written to
+the copy in between each buffer's worth. With the correction, only a
+single byte-order mark is written at the beginning.
+
+Also enhanced the tests test-spit-and-slurp and test-input-stream to
+use non-ASCII characters. No bugs were found as a result of these
+test enhancements.
+---
+ src/clj/clojure/java/io.clj | 24 +++++++------
+ test/clojure/test_clojure/java/io.clj | 57 +++++++++++++++++++--------------
+ 2 files changed, 46 insertions(+), 35 deletions(-)
+
+diff --git a/src/clj/clojure/java/io.clj b/src/clj/clojure/java/io.clj
+index 306f084..20553df 100644
+--- a/src/clj/clojure/java/io.clj
++++ b/src/clj/clojure/java/io.clj
+@@ -302,26 +302,28 @@
+ (recur)))))))
+
+ (defmethod do-copy [InputStream Writer] [#^InputStream input #^Writer output opts]
+- (let [#^"[B" buffer (make-array Byte/TYPE (buffer-size opts))]
++ (let [#^"[C" buffer (make-array Character/TYPE (buffer-size opts))
++ in (InputStreamReader. input (encoding opts))]
+ (loop []
+- (let [size (.read input buffer)]
+- (when (pos? size)
+- (let [chars (.toCharArray (String. buffer 0 size (encoding opts)))]
+- (do (.write output chars)
+- (recur))))))))
++ (let [size (.read in buffer 0 (alength buffer))]
++ (if (pos? size)
++ (do (.write output buffer 0 size)
++ (recur)))))))
+
+ (defmethod do-copy [InputStream File] [#^InputStream input #^File output opts]
+ (with-open [out (FileOutputStream. output)]
+ (do-copy input out opts)))
+
+ (defmethod do-copy [Reader OutputStream] [#^Reader input #^OutputStream output opts]
+- (let [#^"[C" buffer (make-array Character/TYPE (buffer-size opts))]
++ (let [#^"[C" buffer (make-array Character/TYPE (buffer-size opts))
++ out (OutputStreamWriter. output (encoding opts))]
+ (loop []
+ (let [size (.read input buffer)]
+- (when (pos? size)
+- (let [bytes (.getBytes (String. buffer 0 size) (encoding opts))]
+- (do (.write output bytes)
+- (recur))))))))
++ (if (pos? size)
++ (do
++ (.write out buffer 0 size)
++ (recur))
++ (.flush out))))))
+
+ (defmethod do-copy [Reader Writer] [#^Reader input #^Writer output opts]
+ (let [#^"[C" buffer (make-array Character/TYPE (buffer-size opts))]
+diff --git a/test/clojure/test_clojure/java/io.clj b/test/clojure/test_clojure/java/io.clj
+index cdc50ee..e2368e6 100644
+--- a/test/clojure/test_clojure/java/io.clj
++++ b/test/clojure/test_clojure/java/io.clj
+@@ -21,17 +21,20 @@
+ (.deleteOnExit)))
+
+ (deftest test-spit-and-slurp
+- (let [f (temp-file "clojure.java.io" "test")]
+- (spit f "foobar")
+- (is (= "foobar" (slurp f)))
+- (spit f "foobar" :encoding "UTF-16")
+- (is (= "foobar" (slurp f :encoding "UTF-16")))
++ (let [f (temp-file "clojure.java.io" "test")
++ content (apply str (concat "a" (repeat 500 "\u226a\ud83d\ude03")))]
++ (spit f content)
++ (is (= content (slurp f)))
++ ;; UTF-16 must be last for the following test
++ (doseq [enc [ "UTF-8" "UTF-16BE" "UTF-16LE" "UTF-32" "UTF-16" ]]
++ (spit f content :encoding enc)
++ (is (= content (slurp f :encoding enc))))
+ (testing "deprecated arity"
+ (is (=
+ (platform-newlines "WARNING: (slurp f enc) is deprecated, use (slurp f :encoding enc).\n")
+ (with-out-str
+- (is (= "foobar" (slurp f "UTF-16")))))))))
+-
++ (is (= content (slurp f "UTF-16")))))))))
++
+ (deftest test-streams-defaults
+ (let [f (temp-file "clojure.java.io" "test-reader-writer")
+ content "testing"]
+@@ -63,17 +66,21 @@
+ (defn data-fixture
+ "in memory fixture data for tests"
+ [encoding]
+- (let [bs (.getBytes "hello" encoding)
+- cs (.toCharArray "hello")
++ (let [s (apply str (concat "a" (repeat 500 "\u226a\ud83d\ude03")))
++ bs (.getBytes s encoding)
++ cs (.toCharArray s)
+ i (ByteArrayInputStream. bs)
+- r (InputStreamReader. i)
++ ;; Make UTF-8 encoding explicit for the InputStreamReader and
++ ;; OutputStreamWriter, since some JVMs use a different default
++ ;; encoding.
++ r (InputStreamReader. i "UTF-8")
+ o (ByteArrayOutputStream.)
+- w (OutputStreamWriter. o)]
++ w (OutputStreamWriter. o "UTF-8")]
+ {:bs bs
+ :i i
+ :r r
+ :o o
+- :s "hello"
++ :s s
+ :cs cs
+ :w w}))
+
+@@ -90,7 +97,7 @@
+ {:in :bs :out :w}]
+
+ opts
+- [{} {:buffer-size 256}]]
++ [{} {:buffer-size 16} {:buffer-size 256}]]
+ (let [{:keys [s o] :as d} (data-fixture "UTF-8")]
+ (apply copy (in d) (out d) (flatten (vec opts)))
+ #_(when (= out :w) (.flush (:w d)))
+@@ -100,15 +107,16 @@
+ (str "combination " test opts))))))
+
+ (deftest test-copy-encodings
+- (testing "from inputstream UTF-16 to writer UTF-8"
+- (let [{:keys [i s o w bs]} (data-fixture "UTF-16")]
+- (copy i w :encoding "UTF-16")
+- (.flush w)
+- (bytes-should-equal (.getBytes s "UTF-8") (.toByteArray o) "")))
+- (testing "from reader UTF-8 to output-stream UTF-16"
+- (let [{:keys [r o s]} (data-fixture "UTF-8")]
+- (copy r o :encoding "UTF-16")
+- (bytes-should-equal (.getBytes s "UTF-16") (.toByteArray o) ""))))
++ (doseq [enc [ "UTF-8" "UTF-16" "UTF-16BE" "UTF-16LE" "UTF-32" ]]
++ (testing (str "from inputstream " enc " to writer UTF-8")
++ (let [{:keys [i s o w bs]} (data-fixture enc)]
++ (copy i w :encoding enc :buffer-size 16)
++ (.flush w)
++ (bytes-should-equal (.getBytes s "UTF-8") (.toByteArray o) "")))
++ (testing (str "from reader UTF-8 to output-stream " enc)
++ (let [{:keys [r o s]} (data-fixture "UTF-8")]
++ (copy r o :encoding enc :buffer-size 16)
++ (bytes-should-equal (.getBytes s enc) (.toByteArray o) "")))))
+
+ (deftest test-as-file
+ (are [result input] (= result (as-file input))
+@@ -167,8 +175,9 @@
+
+ (deftest test-input-stream
+ (let [file (temp-file "test-input-stream" "txt")
+- bytes (.getBytes "foobar")]
+- (spit file "foobar")
++ content (apply str (concat "a" (repeat 500 "\u226a\ud83d\ude03")))
++ bytes (.getBytes content "UTF-8")]
++ (spit file content)
+ (doseq [[expr msg]
+ [[file File]
+ [(FileInputStream. file) FileInputStream]
+--
+1.7.7.4
+
View
50 patches/CLJ-932-0001.patch
@@ -0,0 +1,50 @@
+From 05149290a80a33a466a61ab94c1fcdb87886916b Mon Sep 17 00:00:00 2001
+From: Stuart Sierra and Alex Redington <pair@thinkrelevance.com>
+Date: Fri, 17 Feb 2012 16:29:57 -0500
+Subject: [PATCH] CLJ-932: contains? should throw exception on non-associative argument
+
+---
+ src/jvm/clojure/lang/RT.java | 2 +-
+ test/clojure/test_clojure/data_structures.clj | 13 ++++---------
+ 2 files changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
+index 0c9cb55..e263c27 100644
+--- a/src/jvm/clojure/lang/RT.java
++++ b/src/jvm/clojure/lang/RT.java
+@@ -710,7 +710,7 @@ static public Object contains(Object coll, Object key){
+ int n = ((Number) key).intValue();
+ return n >= 0 && n < count(coll);
+ }
+- return F;
++ throw new IllegalArgumentException("contains? not supported on type: " + coll.getClass().getName());
+ }
+
+ static public Object find(Object coll, Object key){
+diff --git a/test/clojure/test_clojure/data_structures.clj b/test/clojure/test_clojure/data_structures.clj
+index e3ecaa9..3ed2535 100644
+--- a/test/clojure/test_clojure/data_structures.clj
++++ b/test/clojure/test_clojure/data_structures.clj
+@@ -455,15 +455,10 @@
+ (contains? (into-array [1 2 3]) 3) false
+ (contains? (into-array [1 2 3]) -1) false)
+
+- ; 'contains?' operates constant or logarithmic time,
+- ; it WILL NOT perform a linear search for a value.
+- (are [x] (= x false)
+- (contains? '(1 2 3) 0)
+- (contains? '(1 2 3) 1)
+- (contains? '(1 2 3) 3)
+- (contains? '(1 2 3) 10)
+- (contains? '(1 2 3) nil)
+- (contains? '(1 2 3) ()) ))
++ ; 'contains?' will not operate on non-associative things
++ (are [x] (is (thrown? Exception (contains? x 1)))
++ '(1 2 3)
++ 3))
+
+
+ (deftest test-keys
+--
+1.7.4.1
+
View
38 patches/add-enable-locals-clearing-updated.diff
@@ -0,0 +1,38 @@
+From e69bdcedcc820100b4ad7133a140fd85e41c522d Mon Sep 17 00:00:00 2001
+From: Hugo Duncan <hugo@hugoduncan.org>
+Date: Fri, 21 Oct 2011 14:17:37 -0400
+Subject: [PATCH] Add *enable-locals-clearing* to control locals clearing
+
+When set to false, the canBeCleared flag in LocalBinding is set to false.
+---
+ src/jvm/clojure/lang/Compiler.java | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
+index 3d487f1..9c5b809 100644
+--- a/src/jvm/clojure/lang/Compiler.java
++++ b/src/jvm/clojure/lang/Compiler.java
+@@ -238,6 +238,9 @@ static final public Var INSTANCE = Var.intern(Namespace.findOrCreate(Symbol.inte
+
+ static final public Var ADD_ANNOTATIONS = Var.intern(Namespace.findOrCreate(Symbol.intern("clojure.core")),
+ Symbol.intern("add-annotations"));
++static final public Var ENABLE_LOCALS_CLEARING = Var.intern(Namespace.findOrCreate(Symbol.intern("clojure.core")),
++ Symbol.intern("*enable-locals-clearing*"), Boolean.TRUE).setDynamic();
++//boolean
+
+ //collection of keys
+ static final public Var ELIDE_META = Var.intern(Namespace.findOrCreate(Symbol.intern("clojure.core")),
+@@ -5449,8 +5452,8 @@ public static class LocalBinding{
+ public final int idx;
+ public final String name;
+ public final boolean isArg;
+- public final PathNode clearPathRoot;
+- public boolean canBeCleared = true;
++ public final PathNode clearPathRoot;
++ public boolean canBeCleared = (Boolean)(ENABLE_LOCALS_CLEARING.deref());
+ public boolean recurMistmatch = false;
+
+ public LocalBinding(int num, Symbol sym, Symbol tag, Expr init, boolean isArg,PathNode clearPathRoot)
+--
+1.7.9.2
+
View
45 patches/capitalize-for-supplementary-chars-patch.txt
@@ -0,0 +1,45 @@
+From aacf2f75593ebac899af42f261771d1bd68e388d Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Fri, 24 Feb 2012 23:46:26 -0800
+Subject: [PATCH] Make capitalize work even if first Unicode char is outside
+ BMP
+
+---
+ src/clj/clojure/string.clj | 6 ++++--
+ test/clojure/test_clojure/string.clj | 3 +++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/clj/clojure/string.clj b/src/clj/clojure/string.clj
+index 188b518..e5c5cd4 100644
+--- a/src/clj/clojure/string.clj
++++ b/src/clj/clojure/string.clj
+@@ -151,8 +151,10 @@ Design notes for clojure.string:
+ (let [s (.toString s)]
+ (if (< (count s) 2)
+ (.toUpperCase s)
+- (str (.toUpperCase (subs s 0 1))
+- (.toLowerCase (subs s 1))))))
++ (let [c (.charAt s 0)
++ n (if (Character/isHighSurrogate c) 2 1)]
++ (str (.toUpperCase (subs s 0 n))
++ (.toLowerCase (subs s n)))))))
+
+ (defn ^String upper-case
+ "Converts string to all upper-case."
+diff --git a/test/clojure/test_clojure/string.clj b/test/clojure/test_clojure/string.clj
+index d6f6469..094ee9b 100644
+--- a/test/clojure/test_clojure/string.clj
++++ b/test/clojure/test_clojure/string.clj
+@@ -40,6 +40,9 @@
+ (is (= "" (s/trim-newline ""))))
+
+ (deftest t-capitalize
++ (is (= "\ud801\udc00oobar" (s/capitalize "\ud801\udc28OObAR")))
++ ;; Not complete UTF-16 string, but make sure we don't blow up on it
++ (is (= "\ud801" (s/capitalize "\ud801")))
+ (is (= "Foobar" (s/capitalize "foobar")))
+ (is (= "Foobar" (s/capitalize "FOOBAR"))))
+
+--
+1.7.9
+
View
80 patches/cl-format-efg-coerce-ratios-to-doubes-patch1.txt
@@ -0,0 +1,80 @@
+From af8cf00f6478a7800052e3ec5eec8f3bff2a23a1 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Tue, 21 Feb 2012 18:28:41 -0800
+Subject: [PATCH] Make cl-format coerce args for E, F, and G directives from Ratios to doubles
+
+---
+ src/clj/clojure/pprint/cl_format.clj | 5 ++++-
+ .../clojure/test_clojure/pprint/test_cl_format.clj | 9 +++++++++
+ 2 files changed, 13 insertions(+), 1 deletions(-)
+
+diff --git a/src/clj/clojure/pprint/cl_format.clj b/src/clj/clojure/pprint/cl_format.clj
+index ef5c981..846702e 100644
+--- a/src/clj/clojure/pprint/cl_format.clj
++++ b/src/clj/clojure/pprint/cl_format.clj
+@@ -627,6 +627,7 @@ Note this should only be used for the last one in the sequence"
+ d (:d params)
+ [arg navigator] (next-arg navigator)
+ [sign abs] (if (neg? arg) ["-" (- arg)] ["+" arg])
++ abs (if (instance? clojure.lang.Ratio abs) (double abs) abs)
+ [mantissa exp] (float-parts abs)
+ scaled-exp (+ exp (:k params))
+ add-sign (or (:at params) (neg? arg))
+@@ -663,7 +664,8 @@ Note this should only be used for the last one in the sequence"
+ ;; TODO: support rationals. Back off to ~D/~A is the appropriate cases
+ ;; TODO: define ~E representation for Infinity
+ (defn- exponential-float [params navigator offsets]
+- (let [[arg navigator] (next-arg navigator)]
++ (let [[arg navigator] (next-arg navigator)
++ arg (if (instance? clojure.lang.Ratio arg) (double arg) arg)]
+ (loop [[mantissa exp] (float-parts (if (neg? arg) (- arg) arg))]
+ (let [w (:w params)
+ d (:d params)
+@@ -737,6 +739,7 @@ Note this should only be used for the last one in the sequence"
+ ;; TODO: refactor so that float-parts isn't called twice
+ (defn- general-float [params navigator offsets]
+ (let [[arg _] (next-arg navigator)
++ arg (if (instance? clojure.lang.Ratio arg) (double arg) arg)
+ [mantissa exp] (float-parts (if (neg? arg) (- arg) arg))
+ w (:w params)
+ d (:d params)
+diff --git a/test/clojure/test_clojure/pprint/test_cl_format.clj b/test/clojure/test_clojure/pprint/test_cl_format.clj
+index 8a95104..610c9ed 100644
+--- a/test/clojure/test_clojure/pprint/test_cl_format.clj
++++ b/test/clojure/test_clojure/pprint/test_cl_format.clj
+@@ -514,7 +514,10 @@
+ x x x x x x))
+
+ (simple-tests cltl-F-tests
++ (cl-format false "~10,3f" 4/5) " 0.800"
+ (foo 3.14159) " 3.14| 31.42| 3.14|3.1416|3.14|3.14159"
++ (foo 314159/100000)
++ " 3.14| 31.42| 3.14|3.1416|3.14|3.14159"
+ (foo -3.14159) " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159"
+ (foo 100.0) "100.00|******|100.00| 100.0|100.00|100.0"
+ (foo 1234.0) "1234.00|******|??????|1234.0|1234.00|1234.0"
+@@ -527,7 +530,10 @@
+
+ ;; Clojure doesn't support float/double differences in representation
+ (simple-tests cltl-E-tests
++ (cl-format false "~10,3e" 4/5) " 8.000E-1"
+ (foo-e 0.0314159) " 3.14E-2| 31.42$-03|+.003E+01| 3.14E-2" ; Added this one
++ (foo-e 314159/10000000)
++ " 3.14E-2| 31.42$-03|+.003E+01| 3.14E-2"
+ (foo-e 3.14159) " 3.14E+0| 31.42$-01|+.003E+03| 3.14E+0"
+ (foo-e -3.14159) " -3.14E+0|-31.42$-01|-.003E+03| -3.14E+0"
+ (foo-e 1100.0) " 1.10E+3| 11.00$+02|+.001E+06| 1.10E+3"
+@@ -565,7 +571,10 @@
+
+ ;; Clojure doesn't support float/double differences in representation
+ (simple-tests cltl-G-tests
++ (cl-format false "~10,3g" 4/5) " 0.800 "
+ (foo-g 0.0314159) " 3.14E-2|314.2$-04|0.314E-01| 3.14E-2"
++ (foo-g 314159/10000000)
++ " 3.14E-2|314.2$-04|0.314E-01| 3.14E-2"
+ (foo-g 0.314159) " 0.31 |0.314 |0.314 | 0.31 "
+ (foo-g 3.14159) " 3.1 | 3.14 | 3.14 | 3.1 "
+ (foo-g 31.4159) " 31. | 31.4 | 31.4 | 31. "
+--
+1.7.3.4
+
View
177 patches/clj-667-allow-loop-recur-nested-in-catch-and-finally-patch2.txt
@@ -0,0 +1,177 @@
+From 7459a805b37c1e24cc024e4bd34410b4e62f714b Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Fri, 24 Feb 2012 15:34:00 -0800
+Subject: [PATCH 1/2] Tighten up existing tests for recur across try boundaries.
+
+Some were syntactically incorrect (e.g. loop [x]) and were detecting
+exceptions thrown that weren't from the compiler.
+
+Tests for code that should compile cleanly was ignoring the value
+returned and wrapping them in another try unnecessarily. I simply
+changed them to check that the eval of the expression returned the
+only correct value that should ever be produced.
+
+All updated tests pass.
+---
+ test/clojure/test_clojure/compilation.clj | 36 ++++++++++++++++-------------
+ 1 files changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/test/clojure/test_clojure/compilation.clj b/test/clojure/test_clojure/compilation.clj
+index f8b27de..8fe5631 100644
+--- a/test/clojure/test_clojure/compilation.clj
++++ b/test/clojure/test_clojure/compilation.clj
+@@ -10,6 +10,7 @@
+
+
+ (ns clojure.test-clojure.compilation
++ (:import (clojure.lang Compiler Compiler$CompilerException))
+ (:use clojure.test
+ [clojure.test-helper :only (should-not-reflect should-print-err-message)]))
+
+@@ -54,26 +55,29 @@
+
+ (deftest test-no-recur-across-try
+ (testing "don't recur to function from inside try"
+- (is (thrown? Exception (eval '(fn [x] (try (recur 1)))))))
++ (is (thrown? Compiler$CompilerException
++ (eval '(fn [x] (try (recur 1)))))))
+ (testing "don't recur to loop from inside try"
+- (is (thrown? Exception (eval '(loop [x] (try (recur 1)))))))
++ (is (thrown? Compiler$CompilerException
++ (eval '(loop [x 5]
++ (try (recur 1)))))))
+ (testing "don't get confused about what the recur is targeting"
+- (is (thrown? Exception (eval '(loop [x] (try (fn [x]) (recur 1)))))))
+- (testing "don't allow recur accross binding"
+- (is (thrown? Exception (eval '(fn [x] (binding [+ *] (recur 1)))))))
++ (is (thrown? Compiler$CompilerException
++ (eval '(loop [x 5]
++ (try (fn [x]) (recur 1)))))))
++ (testing "don't allow recur across binding"
++ (is (thrown? Compiler$CompilerException
++ (eval '(fn [x] (binding [+ *] (recur 1)))))))
+ (testing "allow loop/recur inside try"
+- (is (try
+- (eval '(try (loop [x 3] (if (zero? x) x (recur (dec x))))))
+- (catch Exception _))))
++ (is (= 0 (eval '(try (loop [x 3]
++ (if (zero? x) x (recur (dec x)))))))))
+ (testing "allow fn/recur inside try"
+- (is (try
+- (eval '(try
+- ((fn [x]
+- (if (zero? x)
+- x
+- (recur (dec x))))
+- 3)))
+- (catch Exception _)))))
++ (is (= 0 (eval '(try
++ ((fn [x]
++ (if (zero? x)
++ x
++ (recur (dec x))))
++ 3)))))))
+
+ ;; disabled until build box can call java from mvn
+ #_(deftest test-numeric-dispatch
+--
+1.7.3.4
+
+
+From e04a3121db983bb3890058b2470fc2efff483717 Mon Sep 17 00:00:00 2001
+From: Juha Arpiainen <jarpiain@iki.fi>
+Date: Sun, 31 Oct 2010 19:32:25 +0200
+Subject: [PATCH 2/2] Allow loop/recur nested in catch and finally
+
+---
+ src/jvm/clojure/lang/Compiler.java | 8 +++-----
+ test/clojure/test_clojure/compilation.clj | 26 ++++++++++++++++++++++++++
+ 2 files changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
+index bfc8274..dea9310 100644
+--- a/src/jvm/clojure/lang/Compiler.java
++++ b/src/jvm/clojure/lang/Compiler.java
+@@ -2092,7 +2092,7 @@ public static class TryExpr implements Expr{
+ if(bodyExpr == null)
+ try {
+ Var.pushThreadBindings(RT.map(NO_RECUR, true));
+- bodyExpr = (new BodyExpr.Parser()).parse(context, RT.seq(body));
++ bodyExpr = (new BodyExpr.Parser()).parse(C.EXPRESSION, RT.seq(body));
+ } finally {
+ Var.popThreadBindings();
+ }
+@@ -2118,7 +2118,7 @@ public static class TryExpr implements Expr{
+ (Symbol) (RT.second(f) instanceof Symbol ? RT.second(f)
+ : null),
+ null,false);
+- Expr handler = (new BodyExpr.Parser()).parse(context, RT.next(RT.next(RT.next(f))));
++ Expr handler = (new BodyExpr.Parser()).parse(C.EXPRESSION, RT.next(RT.next(RT.next(f))));
+ catches = catches.cons(new CatchClause(c, lb, handler));
+ }
+ finally
+@@ -2147,7 +2147,7 @@ public static class TryExpr implements Expr{
+ try
+ {
+ Var.pushThreadBindings(RT.map(NO_RECUR, true));
+- bodyExpr = (new BodyExpr.Parser()).parse(context, RT.seq(body));
++ bodyExpr = (new BodyExpr.Parser()).parse(C.EXPRESSION, RT.seq(body));
+ }
+ finally
+ {
+@@ -6102,8 +6102,6 @@ public static class RecurExpr implements Expr{
+ IPersistentVector loopLocals = (IPersistentVector) LOOP_LOCALS.deref();
+ if(context != C.RETURN || loopLocals == null)
+ throw new UnsupportedOperationException("Can only recur from tail position");
+- if(IN_CATCH_FINALLY.deref() != null)
+- throw new UnsupportedOperationException("Cannot recur from catch/finally");
+ if(NO_RECUR.deref() != null)
+ throw new UnsupportedOperationException("Cannot recur across try");
+ PersistentVector args = PersistentVector.EMPTY;
+diff --git a/test/clojure/test_clojure/compilation.clj b/test/clojure/test_clojure/compilation.clj
+index 8fe5631..7b2754c 100644
+--- a/test/clojure/test_clojure/compilation.clj
++++ b/test/clojure/test_clojure/compilation.clj
+@@ -61,6 +61,18 @@
+ (is (thrown? Compiler$CompilerException
+ (eval '(loop [x 5]
+ (try (recur 1)))))))
++ (testing "don't recur to loop from inside of catch inside of try"
++ (is (thrown? Compiler$CompilerException
++ (eval '(loop [x 5]
++ (try
++ (catch Exception e
++ (recur 1))))))))
++ (testing "don't recur to loop from inside of finally inside of try"
++ (is (thrown? Compiler$CompilerException
++ (eval '(loop [x 5]
++ (try
++ (finally
++ (recur 1))))))))
+ (testing "don't get confused about what the recur is targeting"
+ (is (thrown? Compiler$CompilerException
+ (eval '(loop [x 5]
+@@ -71,6 +83,20 @@
+ (testing "allow loop/recur inside try"
+ (is (= 0 (eval '(try (loop [x 3]
+ (if (zero? x) x (recur (dec x)))))))))
++ (testing "allow loop/recur fully inside catch"
++ (is (= 3 (eval '(try
++ (throw (Exception.))
++ (catch Exception e
++ (loop [x 0]
++ (if (< x 3) (recur (inc x)) x))))))))
++ (testing "allow loop/recur fully inside finally"
++ (is (= "012" (eval '(with-out-str
++ (try
++ :return-val-discarded-because-of-with-out-str
++ (finally (loop [x 0]
++ (when (< x 3)
++ (print x)
++ (recur (inc x)))))))))))
+ (testing "allow fn/recur inside try"
+ (is (= 0 (eval '(try
+ ((fn [x]
+--
+1.7.3.4
+
View
40 patches/clj-757-fix-behavior-of-empty-transient-maps-patch2.txt
@@ -0,0 +1,40 @@
+From 8f44668040645327a695e24442ca886a14dd806c Mon Sep 17 00:00:00 2001
+From: Alan Malloy <alan@malloys.org>
+Date: Mon, 14 Mar 2011 13:42:44 -0700
+Subject: [PATCH] Fix behavior of empty transient maps.
+
+---
+ src/jvm/clojure/lang/PersistentHashMap.java | 4 ++--
+ test/clojure/test_clojure/transients.clj | 5 ++++-
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/PersistentHashMap.java b/src/jvm/clojure/lang/PersistentHashMap.java
+index 928b123..0359bee 100644
+--- a/src/jvm/clojure/lang/PersistentHashMap.java
++++ b/src/jvm/clojure/lang/PersistentHashMap.java
+@@ -279,7 +279,7 @@ static final class TransientHashMap extends ATransientMap {
+ else
+ return notFound;
+ if (root == null)
+- return null;
++ return notFound;
+ return root.find(0, hash(key), key, notFound);
+ }
+
+diff --git a/test/clojure/test_clojure/transients.clj b/test/clojure/test_clojure/transients.clj
+index 1545c10..aa0b871 100644
+--- a/test/clojure/test_clojure/transients.clj
++++ b/test/clojure/test_clojure/transients.clj
+@@ -23,4 +23,7 @@
+ (is (= [0 {}] (let [ks (concat (range 7) [(hash-obj 42) (hash-obj 42)])
+ m (zipmap ks ks)
+ dm (persistent! (reduce dissoc! (transient m) (keys m)))]
+- [(count dm) dm])))))
+\ No newline at end of file
++ [(count dm) dm])))))
++
++(deftest empty-transient
++ (is (= false (.contains (transient #{}) :bogus-key))))
+--
+1.7.3.4
+
View
45 patches/clj-783-patch.txt
@@ -0,0 +1,45 @@
+From 24a8421f657243465c74956db04cf7e4166357dd Mon Sep 17 00:00:00 2001
+From: Jason Wolfe <jason@w01fe.com>
+Date: Tue, 14 Feb 2012 10:49:44 -0800
+Subject: [PATCH] Makes inspect-tree work on java.util.Sets and
+ clojure.lang.Seqable's.
+
+---
+ src/clj/clojure/inspector.clj | 12 ++++++++----
+ 1 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/clj/clojure/inspector.clj b/src/clj/clojure/inspector.clj
+index aa708b5..85e79c0 100644
+--- a/src/clj/clojure/inspector.clj
++++ b/src/clj/clojure/inspector.clj
+@@ -22,8 +22,10 @@
+ (defn collection-tag [x]
+ (cond
+ (instance? java.util.Map$Entry x) :entry
+- (instance? java.util.Map x) :map
++ (instance? java.util.Map x) :seqable
++ (instance? java.util.Set x) :seqable
+ (sequential? x) :seq
++ (instance? clojure.lang.Seqable x) :seqable
+ :else :atom))
+
+ (defmulti is-leaf collection-tag)
+@@ -44,10 +46,12 @@
+ (defmethod get-child-count :entry [e]
+ (count (val e)))
+
+-(defmethod is-leaf :map [m]
++(defmethod is-leaf :seqable [parent]
+ false)
+-(defmethod get-child :map [m index]
+- (nth (seq m) index))
++(defmethod get-child :seqable [parent index]
++ (nth (seq parent) index))
++(defmethod get-child-count :seqable [parent]
++ (count (seq parent)))
+
+ (defn tree-model [data]
+ (proxy [TreeModel] []
+--
+1.7.7.4
+
View
27 patches/clj-831-await-for-doc-string-patch.txt
@@ -0,0 +1,27 @@
+From 1890e8d9199e976745d93bfb5aa664514dd28a64 Mon Sep 17 00:00:00 2001
+From: David McNeil <dmcneil@revelytix.com>
+Date: Fri, 24 Feb 2012 09:29:46 -0800
+Subject: [PATCH] await-for return value doc fix
+
+---
+ src/clj/clojure/core.clj | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 1dc12c3..c782a59 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -2879,8 +2879,8 @@
+ (defn await-for
+ "Blocks the current thread until all actions dispatched thus
+ far (from this thread or agent) to the agents have occurred, or the
+- timeout (in milliseconds) has elapsed. Returns nil if returning due
+- to timeout, non-nil otherwise."
++ timeout (in milliseconds) has elapsed. Returns logical false if
++ returning due to timeout, logical true otherwise."
+ {:added "1.0"
+ :static true}
+ [timeout-ms & agents]
+--
+1.7.3.4
+
View
109 patches/clj-833-defrecord-factory-docstrings-3.patch
@@ -0,0 +1,109 @@
+From c1d2cef4b19893380a160610c215c385c7c311ab Mon Sep 17 00:00:00 2001
+From: Chris Perkins <chrisperkins99@gmail.com>
+Date: Fri, 17 Feb 2012 01:48:28 -0800
+Subject: [PATCH] Docstrings for generated factory functions.
+
+Also add to the docstrings of deftype and defrecord to indicate that the
+factories will be generated.
+
+Fixed test that expected public vars to have :added metadata - generated
+factory functions ->Vec, ->ArrayChunk, etc. do not have :added.
+---
+ src/clj/clojure/core_deftype.clj | 16 +++++++++++++---
+ test/clojure/test_clojure/metadata.clj | 5 ++++-
+ test/clojure/test_clojure/protocols.clj | 6 +++++-
+ 3 files changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj
+index 042c242..0f7ea40 100644
+--- a/src/clj/clojure/core_deftype.clj
++++ b/src/clj/clojure/core_deftype.clj
+@@ -248,8 +248,10 @@
+ [field-args over] (split-at 20 fields)
+ field-count (count fields)
+ arg-count (count field-args)
+- over-count (count over)]
++ over-count (count over)
++ docstring (str "Positional factory function for class " classname ".")]
+ `(defn ~fn-name
++ ~docstring
+ [~@field-args ~@(if (seq over) '[& overage] [])]
+ ~(if (seq over)
+ `(if (= (count ~'overage) ~over-count)
+@@ -329,7 +331,11 @@
+ map (nil for none), and one taking only the fields (using nil for
+ meta and extension fields). Note that the field names __meta
+ and __extmap are currently reserved and should not be used when
+- defining your own records."
++ defining your own records.
++
++ Given (defrecord TypeName ...), two factory functions will be
++ defined: ->TypeName, taking positional parameters for the fields,
++ and map->TypeName, taking a map of keywords to field values."
+ {:added "1.2"}
+
+ [name [& fields] & opts+specs]
+@@ -347,6 +353,7 @@
+ (import ~classname)
+ ~(build-positional-factory gname classname fields)
+ (defn ~(symbol (str 'map-> gname))
++ ~(str "Factory function for class " classname ", taking a map of keywords to field values.")
+ ([m#] (~(symbol (str classname "/create")) m#)))
+ ~classname)))
+
+@@ -418,7 +425,10 @@
+
+ One constructor will be defined, taking the designated fields. Note
+ that the field names __meta and __extmap are currently reserved and
+- should not be used when defining your own types."
++ should not be used when defining your own types.
++
++ Given (deftype TypeName ...), a factory function called ->TypeName
++ will be defined, taking positional parameters for the fields"
+ {:added "1.2"}
+
+ [name [& fields] & opts+specs]
+diff --git a/test/clojure/test_clojure/metadata.clj b/test/clojure/test_clojure/metadata.clj
+index 7719f06..bb6635c 100644
+--- a/test/clojure/test_clojure/metadata.clj
++++ b/test/clojure/test_clojure/metadata.clj
+@@ -38,8 +38,11 @@
+ (def public-vars-with-docstrings
+ (filter (comp :doc meta) public-vars))
+
++(def public-vars-with-docstrings-not-generated
++ (remove #(re-find #"^->[A-Z]" (name (.sym %))) public-vars-with-docstrings))
++
+ (deftest public-vars-with-docstrings-have-added
+- (is (= [] (remove (comp :added meta) public-vars-with-docstrings))))
++ (is (= [] (remove (comp :added meta) public-vars-with-docstrings-not-generated))))
+
+ (deftest interaction-of-def-with-metadata
+ (testing "initial def sets metadata"
+diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj
+index 71966bf..1e7a199 100644
+--- a/test/clojure/test_clojure/protocols.clj
++++ b/test/clojure/test_clojure/protocols.clj
+@@ -279,7 +279,7 @@
+ (defrecord RecordToTestHugeFactories [a b c d e f g h i j k l m n o p q r s t u v w x y z])
+
+ (deftest test-record-factory-fns
+- (testing "if the definition of a defrecord generates the appropriate factory funcitons"
++ (testing "if the definition of a defrecord generates the appropriate factory functions"
+ (let [r (RecordToTestFactories. 1 2 3)
+ r-n (RecordToTestFactories. nil nil nil)
+ huge (RecordToTestHugeFactories. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26)]
+@@ -289,6 +289,10 @@
+ (testing "that a record created with the ctor equals one by the map-> factory fn"
+ (is (= r (map->RecordToTestFactories {:a 1 :b 2 :c 3})))
+ (is (= r-n (map->RecordToTestFactories {}))))
++ (testing "that factory functions have docstrings"
++ ;; just test non-nil to avoid overspecifiying what's in the docstring
++ (is (false? (-> ->RecordToTestFactories var meta :doc nil?)))
++ (is (false? (-> map->RecordToTestFactories var meta :doc nil?))))
+ (testing "that a literal record equals one by the positional factory fn"
+ (is (= #clojure.test_clojure.protocols.RecordToTestFactories{:a 1 :b 2 :c 3} (->RecordToTestFactories 1 2 3)))
+ (is (= #clojure.test_clojure.protocols.RecordToTestFactories{:a 1 :b nil :c nil} (->RecordToTestFactories 1 nil nil)))
+--
+1.7.3.4
+
View
99 patches/clj-850-type-hinted-fn-abstractmethoderror-patch2.txt
@@ -0,0 +1,99 @@
+From d113e9a0820843ed7f837af8ebfa61267ccd35b9 Mon Sep 17 00:00:00 2001
+From: Ben Smith-Mannschott <bsmith.occs@gmail.com>
+Date: Tue, 18 Oct 2011 21:51:13 +0200
+Subject: [PATCH] CLJ-850: Be sure invokePrim returning subclass of of Object properly implements Fn$XX
+
+Given:
+ - P is some primitive type
+ - O is type Object
+ - R some subclass of Object:
+
+When Clojure generates a `R invokePrim(P x)`, it also generates a
+`O invoke(O x)` , which delegates to `R invokePrim(P x)`.
+
+`R invokePrim(P x)` overloads, but does not override the method of
+the corresponding Fn$PO interface. (Java, the virtual machine, supports
+overloading on return type, though Java the language does not.)
+
+Clojure needs to generate an additional `O invokePrim(P x)` method to
+satisfy the interface. This also delegates to `R invokePrim(P x)`.
+---
+ src/jvm/clojure/lang/Compiler.java | 22 +++++++++++++++++++---
+ test/clojure/test_clojure/metadata.clj | 21 +++++++++++++++++++++
+ 2 files changed, 40 insertions(+), 3 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
+index bfc8274..e855e1e 100644
+--- a/src/jvm/clojure/lang/Compiler.java
++++ b/src/jvm/clojure/lang/Compiler.java
+@@ -5089,8 +5089,22 @@ public static class FnMethod extends ObjMethod{
+
+ }
+
++ private boolean isSubclassOfObject(Type t){
++ final String d = t.getDescriptor();
++ return d.startsWith("L") && !d.equals("Ljava/lang/Object;");
++ }
++
+ public void doEmitPrim(ObjExpr fn, ClassVisitor cv){
+- Method ms = new Method("invokePrim", getReturnType(), argtypes);
++ Type returnType = getReturnType();
++ if (isSubclassOfObject(returnType))
++ doEmitPrim(fn, cv, OBJECT_TYPE);
++ doEmitPrim(fn, cv, returnType);
++ doEmitDelegatingToPrim(fn, cv, returnType);
++ }
++
++ private void doEmitPrim(ObjExpr fn, ClassVisitor cv, Type returnType){
++
++ Method ms = new Method("invokePrim", returnType, argtypes);
+
+ GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_FINAL,
+ ms,
+@@ -5127,10 +5141,12 @@ public static class FnMethod extends ObjMethod{
+ gen.returnValue();
+ //gen.visitMaxs(1, 1);
+ gen.endMethod();
++ }
+
+- //generate the regular invoke, calling the prim method
++ private void doEmitDelegatingToPrim(ObjExpr fn, ClassVisitor cv, Type returnType) {
+ Method m = new Method(getMethodName(), OBJECT_TYPE, getArgTypes());
+-
++ Method ms = new Method("invokePrim", returnType, argtypes);
++ GeneratorAdapter gen;
+ gen = new GeneratorAdapter(ACC_PUBLIC,
+ m,
+ null,
+diff --git a/test/clojure/test_clojure/metadata.clj b/test/clojure/test_clojure/metadata.clj
+index 7719f06..254f96b 100644
+--- a/test/clojure/test_clojure/metadata.clj
++++ b/test/clojure/test_clojure/metadata.clj
+@@ -75,3 +75,24 @@
+ (def-quux)
+ #'quux)]
+ (is (nil? (-> v meta :e)))))))
++
++(deftest defn-primitive-args
++ (testing "Hinting the arg vector of a primitive-taking fn with a non-primitive type should not result in AbstractMethodError when invoked."
++ (testing "CLJ-850 is fixed when this case passes."
++ (is (= "foo"
++ (eval-in-temp-ns
++ (defn f ^String [^String s ^long i] s)
++ (f "foo" 1)))))
++ (testing "These cases should pass, even without a fix for CLJ-850."
++ (is (= "foo"
++ (eval-in-temp-ns
++ (defn f ^String [^String s] s)
++ (f "foo"))))
++ (is (= 1
++ (eval-in-temp-ns
++ (defn f ^long [^String s ^long i] i)
++ (f "foo" 1))))
++ (is (= 1
++ (eval-in-temp-ns
++ (defn f ^long [^long i] i)
++ (f 1)))))))
+--
+1.7.3.4
+
View
75 patches/clj-873-namespace-divides-patch.txt
@@ -0,0 +1,75 @@
+From ed9858ace4c48645772e5f2b28cf3b8f118c930a Mon Sep 17 00:00:00 2001
+From: Chris Gray <chrismgray@gmail.com>
+Date: Wed, 9 Nov 2011 22:23:15 -0700
+Subject: [PATCH] Allow foo// meaning the function / in namespace foo
+
+Added regression tests
+---
+ src/jvm/clojure/lang/LispReader.java | 10 +---------
+ src/jvm/clojure/lang/Symbol.java | 2 +-
+ test/clojure/test_clojure/reader.clj | 8 ++++++++
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/src/jvm/clojure/lang/LispReader.java b/src/jvm/clojure/lang/LispReader.java
+index b0eb8b8..cd4c2ff 100644
+--- a/src/jvm/clojure/lang/LispReader.java
++++ b/src/jvm/clojure/lang/LispReader.java
+@@ -58,7 +58,7 @@ static Symbol DEREF = Symbol.intern("clojure.core", "deref");
+ static IFn[] macros = new IFn[256];
+ static IFn[] dispatchMacros = new IFn[256];
+ //static Pattern symbolPat = Pattern.compile("[:]?([\\D&&[^:/]][^:/]*/)?[\\D&&[^:/]][^:/]*");
+-static Pattern symbolPat = Pattern.compile("[:]?([\\D&&[^/]].*/)?([\\D&&[^/]][^/]*)");
++static Pattern symbolPat = Pattern.compile("[:]?([\\D&&[^/]].*/)?(/|[\\D&&[^/]][^/]*)");
+ //static Pattern varPat = Pattern.compile("([\\D&&[^:\\.]][^:\\.]*):([\\D&&[^:\\.]][^:\\.]*)");
+ //static Pattern intPat = Pattern.compile("[-+]?[0-9]+\\.?");
+ static Pattern intPat =
+@@ -304,14 +304,6 @@ static private Object interpretToken(String s) {
+ {
+ return RT.F;
+ }
+- else if(s.equals("/"))
+- {
+- return SLASH;
+- }
+- else if(s.equals("clojure.core//"))
+- {
+- return CLOJURE_SLASH;
+- }
+ Object ret = null;
+
+ ret = matchSymbol(s);
+diff --git a/src/jvm/clojure/lang/Symbol.java b/src/jvm/clojure/lang/Symbol.java
+index d39f53c..f78f1cc 100644
+--- a/src/jvm/clojure/lang/Symbol.java
++++ b/src/jvm/clojure/lang/Symbol.java
+@@ -57,7 +57,7 @@ static public Symbol intern(String ns, String name){
+ }
+
+ static public Symbol intern(String nsname){
+- int i = nsname.lastIndexOf('/');
++ int i = nsname.indexOf('/');
+ if(i == -1 || nsname.equals("/"))
+ return new Symbol(null, nsname.intern());
+ else
+diff --git a/test/clojure/test_clojure/reader.clj b/test/clojure/test_clojure/reader.clj
+index be6d237..14ca247 100644
+--- a/test/clojure/test_clojure/reader.clj
++++ b/test/clojure/test_clojure/reader.clj
+@@ -320,6 +320,14 @@
+
+ (deftest t-read)
+
++(deftest division
++ (is (= clojure.core// /))
++ (binding [*ns* *ns*]
++ (eval '(do (ns foo
++ (:require [clojure.core :as bar])
++ (:use [clojure.test]))
++ (is (= clojure.core// bar//))))))
++
+ (deftest Instants
+ (testing "Instants are read as java.util.Date by default"
+ (is (= java.util.Date (class #inst "2010-11-12T13:14:15.666"))))
+--
+1.7.3.4
+
View
30 patches/clj-893-doc-vec-aliases-java-array-patch.txt
@@ -0,0 +1,30 @@
+From b0316505395a2f0efbb4906e78396e54a996ca54 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Fri, 24 Feb 2012 18:30:17 -0800
+Subject: [PATCH] Document that vec can alias mutable collections passed to it.
+
+---
+ src/clj/clojure/core.clj | 7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 1dc12c3..88faf83 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -338,7 +338,12 @@
+ (. clojure.lang.LazilyPersistentVector (create (cons a (cons b (cons c (cons d args))))))))
+
+ (defn vec
+- "Creates a new vector containing the contents of coll."
++ "Creates a new vector containing the contents of coll. If coll is
++ mutable, e.g. a Java array, the new vector and coll may share
++ memory, and modifying coll could modify the contents of the vector.
++ Either copy coll first (e.g. aclone for Java arrays), or never
++ modify coll again (e.g. it is a temporary used only for creating
++ the vector)."
+ {:added "1.0"
+ :static true}
+ ([coll]
+--
+1.7.3.4
+
View
601 patches/clj-894-better-reduce-performance-patch2.txt
@@ -0,0 +1,601 @@
+From ae1ea5637a71dab1478a9c1dc6162d1b18486cc9 Mon Sep 17 00:00:00 2001
+From: Mike Anderson <mike_r_anderson@yahoo.co.uk>
+Date: Sun, 4 Dec 2011 22:58:50 -0800
+Subject: [PATCH] Improvements to reduce performance
+
+Convert reduce to use internal-reduce for both arities, backed by
+IReduce in Java
+
+---
+ src/clj/clojure/core.clj | 7 +-
+ src/clj/clojure/core/protocols.clj | 117 ++++++++++++++++-----------
+ src/jvm/clojure/lang/ArrayChunk.java | 14 +++-
+ src/jvm/clojure/lang/ArraySeq.java | 2 +-
+ src/jvm/clojure/lang/IReduce.java | 7 +-
+ src/jvm/clojure/lang/PersistentHashMap.java | 64 ++++++++++++++-
+ src/jvm/clojure/lang/PersistentVector.java | 35 +++++++-
+ src/jvm/clojure/lang/RT.java | 38 +++++++++
+ src/jvm/clojure/lang/StringSeq.java | 21 +++++-
+ src/script/run_tests.clj | 1 +
+ test/clojure/test_clojure/reduce.clj | 56 +++++++++++++
+ 11 files changed, 295 insertions(+), 67 deletions(-)
+ create mode 100644 test/clojure/test_clojure/reduce.clj
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 1dc12c3..6bed802 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -6016,12 +6016,9 @@
+ items, returns val and f is not called."
+ {:added "1.0"}
+ ([f coll]
+- (if-let [s (seq coll)]
+- (reduce f (first s) (next s))
+- (f)))
++ (clojure.core.protocols/internal-reduce coll f))
+ ([f val coll]
+- (let [s (seq coll)]
+- (clojure.core.protocols/internal-reduce s f val))))
++ (clojure.core.protocols/internal-reduce coll f val)))
+
+ (defn into
+ "Returns a new coll consisting of to-coll with all of the items of
+diff --git a/src/clj/clojure/core/protocols.clj b/src/clj/clojure/core/protocols.clj
+index bcf4f7b..ac0b66a 100644
+--- a/src/clj/clojure/core/protocols.clj
++++ b/src/clj/clojure/core/protocols.clj
+@@ -9,71 +9,95 @@
+ (ns clojure.core.protocols)
+
+ (defprotocol InternalReduce
+- "Protocol for concrete seq types that can reduce themselves
++ "Protocol for concrete types that can reduce themselves
+ faster than first/next recursion. Called by clojure.core/reduce."
+- (internal-reduce [seq f start]))
++ (internal-reduce
++ [seq f]
++ [seq f start]))
+
+ (extend-protocol InternalReduce
+ nil
+ (internal-reduce
+- [s f val]
+- val)
++ ([s f]
++ (f))
++ ([s f val]
++ val))
+
+- ;; handles vectors and ranges
+- clojure.lang.IChunkedSeq
+- (internal-reduce
+- [s f val]
+- (if-let [s (seq s)]
+- (if (chunked-seq? s)
+- (recur (chunk-next s)
+- f
+- (.reduce (chunk-first s) f val))
+- (internal-reduce s f val))
+- val))
+-
+- clojure.lang.StringSeq
++ ;; handle reducible collection types directly
++ clojure.lang.IReduce
+ (internal-reduce
+- [str-seq f val]
+- (let [s (.s str-seq)]
+- (loop [i (.i str-seq)
+- val val]
+- (if (< i (.length s))
+- (recur (inc i) (f val (.charAt s i)))
+- val))))
++ ([s f]
++ (.reduce s f))
++ ([s f val]
++ (.reduce s f val)))
+
+- clojure.lang.ArraySeq
++ ;; special case handling for strings
++ java.lang.String
+ (internal-reduce
+- [a-seq f val]
+- (let [^objects arr (.array a-seq)]
+- (loop [i (.index a-seq)
+- val val]
+- (if (< i (alength arr))
+- (recur (inc i) (f val (aget arr i)))
+- val))))
++ ([s f]
++ (if (= 0 (.length s))
++ (f)
++ (loop [i 1
++ val ^Object (.charAt s 0)]
++ (if (< i (.length s))
++ (recur (inc i) (f val (.charAt s i)))
++ val))))
++ ([s f val]
++ (loop [i 0
++ val val]
++ (if (< i (.length s))
++ (recur (inc i) (f val (.charAt s i)))
++ val))))
+
+- java.lang.Object
++ clojure.lang.ISeq
+ (internal-reduce
+- [s f val]
+- (loop [cls (class s)
+- s s
+- f f
+- val val]
+- (if-let [s (seq s)]
+- ;; roll over to faster implementation if underlying seq changes type
+- (if (identical? (class s) cls)
+- (recur cls (next s) f (f val (first s)))
+- (internal-reduce s f val))
+- val))))
++ ([s f]
++ (internal-reduce (next s) f (first s)))
++ ([s f val]
++ (loop [cls (class s)
++ s (seq s)
++ f f
++ val val]
++ (if s
++ ;; roll over to faster implementation if underlying seq changes type
++ (if (identical? (class s) cls)
++ (recur cls (next s) f (f val (first s)))
++ (internal-reduce s f val))
++ val))))
++
++ java.lang.Object
++ (internal-reduce
++ ([s f]
++ (if-let [ss ^clojure.lang.ISeq (seq s)]
++ (internal-reduce (next ss) f (first ss))
++ (f)))
++ ([s f val]
++ (if-let [ss ^clojure.lang.ISeq (seq s)]
++ (internal-reduce ss f val)
++ val)))
++
++ )
+
+ (def arr-impl
+ '(internal-reduce
+- [a-seq f val]