Skip to content

Commit 3b0af1b

Browse files
alexander-yakushevstuarthalloway
authored andcommitted
CLJ-1657: Treat abstract methods like interface methods in proxies
Before this patch, generate-proxy for abstract classes produced incorrect bytecode, with a call to super's method (which obviously doesn't exist for abstract methods). Signed-off-by: Stuart Halloway <[email protected]>
1 parent 2d45fbb commit 3b0af1b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/clj/clojure/core_proxy.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@
210210
(for [^Class iface interfaces meth (. iface (getMethods))
211211
:let [msig (method-sig meth)] :when (not (considered msig))]
212212
{msig meth}))
213+
;; Treat abstract methods as interface methods
214+
[mm ifaces-meths] (let [abstract? (fn [[_ ^Method meth]]
215+
(Modifier/isAbstract (. meth (getModifiers))))
216+
mm-no-abstract (remove abstract? mm)
217+
abstract-meths (filter abstract? mm)]
218+
[mm-no-abstract (concat ifaces-meths abstract-meths)])
213219
mgroups (group-by-sig (concat mm ifaces-meths))
214220
rtypes (map #(most-specific (keys %)) mgroups)
215221
mb (map #(vector (%1 %2) (vals (dissoc %1 %2))) mgroups rtypes)

0 commit comments

Comments
 (0)