|
350 | 350 | {:added "1.0" |
351 | 351 | :static true} |
352 | 352 | [^Type c x] ;;; changed Class to Type |
353 | | - (if (clojure.lang.Util/identical x nil) nil (if (. c (IsInstanceOfType x)) x (throw (InvalidCastException. (.ToString (.GetType x))))))) ;;; original (. c (cast x))) |
| 353 | + (if (clojure.lang.Util/identical x nil) nil (if (. c (IsInstanceOfType x)) x (throw (InvalidCastException. (.ToString (.GetType ^Object x))))))) ;;; original (. c (cast x))) ;; Added ^Object |
354 | 354 |
|
355 | 355 | (defn vector |
356 | 356 | "Creates a new vector containing the args." |
|
1381 | 1381 |
|
1382 | 1382 | (defn unsigned-bit-shift-right |
1383 | 1383 | "Bitwise shift right, without sign-extension." |
1384 | | - {:inline (fn [x n] `(. clojure.lang.Numbers (unsignedShiftRight ~x ~n))) |
| 1384 | + {:inline (fn [x n] `(. clojure.lang.Numbers (unsignedShiftRight ^Object ~x ^Object ~n))) ;;; Added type hints |
1385 | 1385 | :added "1.6"} |
1386 | | - [x n] (. clojure.lang.Numbers unsignedShiftRight x n)) |
| 1386 | + [x n] (. clojure.lang.Numbers unsignedShiftRight ^Object x ^Object n)) ;;; Added type hints |
1387 | 1387 |
|
1388 | 1388 | (defn integer? |
1389 | 1389 | "Returns true if n is an integer" |
|
1815 | 1815 | {:added "1.0" |
1816 | 1816 | :static true} |
1817 | 1817 | [multifn dispatch-val] |
1818 | | - (. multifn removeMethod dispatch-val)) |
| 1818 | + (. ^clojure.lang.MultiFn multifn removeMethod dispatch-val)) ;;; Added type hint |
1819 | 1819 |
|
1820 | 1820 | (defn prefer-method |
1821 | 1821 | "Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y |
1822 | 1822 | when there is a conflict" |
1823 | 1823 | {:added "1.0" |
1824 | 1824 | :static true} |
1825 | 1825 | [multifn dispatch-val-x dispatch-val-y] |
1826 | | - (. multifn preferMethod dispatch-val-x dispatch-val-y)) |
| 1826 | + (. ^clojure.lang.MultiFn multifn preferMethod dispatch-val-x dispatch-val-y)) ;;; Added type hint |
1827 | 1827 |
|
1828 | 1828 | (defn methods |
1829 | 1829 | "Given a multimethod, returns a map of dispatch values -> dispatch fns" |
|
2489 | 2489 | {:added "1.1" |
2490 | 2490 | :static true} |
2491 | 2491 | ([^clojure.lang.Ref ref] |
2492 | | - (.getMinHistory ref)) |
| 2492 | + (.get_MinHistory ref)) ;;; .getMinHistory |
2493 | 2493 | ([^clojure.lang.Ref ref n] |
2494 | 2494 | (.setMinHistory ref n))) |
2495 | 2495 |
|
|
2498 | 2498 | {:added "1.1" |
2499 | 2499 | :static true} |
2500 | 2500 | ([^clojure.lang.Ref ref] |
2501 | | - (.getMaxHistory ref)) |
| 2501 | + (.get_MaxHistory ref)) ;;; .getMaxHistory |
2502 | 2502 | ([^clojure.lang.Ref ref n] |
2503 | 2503 | (.setMaxHistory ref n))) |
2504 | 2504 |
|
|
3682 | 3682 | (instance? clojure.lang.BigInt x) (.ToBigDecimal ^clojure.lang.BigInt x) ;;; .ToBigDecimal |
3683 | 3683 | (instance? BigInteger x) (BigDecimal/Create ^BigInteger x) ;;; (BigDecimal. ^BigInteger x) |
3684 | 3684 | (number? x) (BigDecimal/Create (long x)) ;;; (BigDecimal/valueOf (long x)) |
3685 | | - :else (BigDecimal/Create x))) ;;; (BigDecimal. x))) |
| 3685 | + :else (BigDecimal/Create x))) ;;; (BigDecimal. x))) -- will get a reflection warning -- we just have to wing it here. |
3686 | 3686 |
|
3687 | 3687 | (def ^:dynamic ^{:private true} print-initialized false) |
3688 | 3688 |
|
@@ -3938,25 +3938,25 @@ Note that read can execute code (controlled by *read-eval*), |
3938 | 3938 | (defn aget |
3939 | 3939 | "Returns the value at the index/indices. Works on Java arrays of all |
3940 | 3940 | types." |
3941 | | - {:inline (fn [a i] `(. clojure.lang.RT (aget ~a (int ~i)))) |
| 3941 | + {:inline (fn [a i] `(. clojure.lang.RT (agetOnArray ~a (int ~i)))) |
3942 | 3942 | :inline-arities #{2} |
3943 | 3943 | :added "1.0"} |
3944 | 3944 | ([array idx] |
3945 | | - (clojure.lang.Reflector/prepRet (.GetElementType (class array)) (. array (GetValue idx)))) ;;; was .getComponentType (. Array (get array idx))) |
| 3945 | + (clojure.lang.Reflector/prepRet (.GetElementType (class array)) (. ^System.Array array (GetValue ^int idx)))) ;;; was .getComponentType (. Array (get array idx))) |
3946 | 3946 | ([array idx & idxs] |
3947 | 3947 | (apply aget (aget array idx) idxs))) |
3948 | 3948 |
|
3949 | 3949 | (defn aset |
3950 | 3950 | "Sets the value at the index/indices. Works on Java arrays of |
3951 | 3951 | reference types. Returns val." |
3952 | | - {:inline (fn [a i v] `(. clojure.lang.RT (aset ~a (int ~i) ~v))) |
| 3952 | + {:inline (fn [^System.Array a i v] `(. clojure.lang.RT (aset ~a (int ~i) ~v))) |
3953 | 3953 | :inline-arities #{3} |
3954 | 3954 | :added "1.0"} |
3955 | 3955 | ([array idx val] |
3956 | | - (. array (SetValue val idx)) ;;; was (. Array (set array idx val)) |
| 3956 | + (. ^System.Array array (SetValue val (int idx))) ;;; was (. Array (set array idx val)) |
3957 | 3957 | val) |
3958 | 3958 | ([array idx idx2 & idxv] |
3959 | | - (apply aset (aget array idx) idx2 idxv))) |
| 3959 | + (apply aset (aget ^System.Array array idx) idx2 idxv))) |
3960 | 3960 |
|
3961 | 3961 | (defmacro |
3962 | 3962 | ^{:private true} |
@@ -4034,7 +4034,7 @@ Note that read can execute code (controlled by *read-eval*), |
4034 | 4034 | :added "1.0" |
4035 | 4035 | :static true} |
4036 | 4036 | [^System.Collections.ICollection coll] ;;; ^java.util.Collection |
4037 | | - (let [ret (make-array Object (.Count coll))] ;;; NEED BETTER TYPING HERE (make-array (. Class (forName "[Ljava.lang.Object;")) (. coll (size)))] |
| 4037 | + (let [^|System.Object[]| ret (make-array Object (.Count coll))] ;;; (make-array (. Class (forName "[Ljava.lang.Object;")) (. coll (size)))] -- added type hint |
4038 | 4038 | (loop [i 0 xs (seq coll)] |
4039 | 4039 | (when xs |
4040 | 4040 | (aset ret i (to-array (first xs))) |
@@ -4218,7 +4218,7 @@ Note that read can execute code (controlled by *read-eval*), |
4218 | 4218 | :static true} |
4219 | 4219 | [ns] |
4220 | 4220 | (let [ns (the-ns ns)] |
4221 | | - (filter-key val (fn [ v] (and (instance? clojure.lang.Var v) ;;; removed the tag on v: ^clojure.lang.Var |
| 4221 | + (filter-key val (fn [^clojure.lang.Var v] (and (instance? clojure.lang.Var v) |
4222 | 4222 | (= ns (.ns v)) |
4223 | 4223 | (.isPublic v))) |
4224 | 4224 | (ns-map ns)))) |
@@ -4834,7 +4834,7 @@ Note that read can execute code (controlled by *read-eval*), |
4834 | 4834 | that carries a map of additional data." |
4835 | 4835 | {:added "1.4"} |
4836 | 4836 | ([msg map] |
4837 | | - (elide-top-frames (ExceptionInfo. msg map) "clojure.core$ex_info")) |
| 4837 | + (elide-top-frames (ExceptionInfo. ^String msg map) "clojure.core$ex_info")) ;;; Added type hint -- conflicting overload on 2 args |
4838 | 4838 | ([msg map cause] |
4839 | 4839 | (elide-top-frames (ExceptionInfo. msg map cause) "clojure.core$ex_info"))) |
4840 | 4840 |
|
|
0 commit comments