Strange behaviour for proxy when two abstract classes are passed in

67 views
Skip to first unread message

zcaudate

unread,
Mar 31, 2014, 5:34:17 PM3/31/14
to clo...@googlegroups.com
I know this is a silly example but I am curious to know what is happening with the proxy method.

I have set up two calls to proxy:

1.
  (def cp
    (proxy [java.util.AbstractMap clojure.asm.ClassVisitor] []))

2.
  (def cp
    (proxy [clojure.asm.ClassVisitor java.util.AbstractMap] []))


The first call is fine.... and it return cp.  The second call gives me an exception.

clojure.lang.Compiler$CompilerException: java.lang.IncompatibleClassChangeError: Implementing class, compiling:(/private/var/folders/dd/qfdy6sbn3mlgk20vcxc3j0ljnpxsqr/T/form-init4780219965491827451.clj:2:5)
 java.lang.IncompatibleClassChangeError: Implementing class
                                        java.lang.ClassLoader.defineClass1         ClassLoader.java      
                                         java.lang.ClassLoader.defineClass         ClassLoader.java:  800
                                         java.lang.ClassLoader.defineClass         ClassLoader.java:  643
                               clojure.lang.DynamicClassLoader.defineClass  DynamicClassLoader.java:   46
                                              clojure.core/get-proxy-class           core_proxy.clj:  262


A. Webb

unread,
Apr 1, 2014, 10:41:22 AM4/1/14
to clo...@googlegroups.com


On Monday, March 31, 2014 4:34:17 PM UTC-5, zcaudate wrote:
I know this is a silly example but I am curious to know what is happening with the proxy method.

I have set up two calls to proxy:

1.
  (def cp
    (proxy [java.util.AbstractMap clojure.asm.ClassVisitor] []))

2.
  (def cp
    (proxy [clojure.asm.ClassVisitor java.util.AbstractMap] []))


The first call is fine.... and it return cp.  The second call gives me an exception.

You cross-posted to Stack Overflow Stack Overflow. Copy of my answer there:

Neither will work in Clojure 1.6.0. In 1.5, `clojure.asm.ClassVisitor` was an interface instead of an abstract class. Proxy expects at most one class followed by optional interfaces. As `java.util.AbstractMap` is an abstract class, it cannot appear second in the list of class-and-interfaces.

Chris Zheng

unread,
Apr 1, 2014, 6:09:26 PM4/1/14
to clo...@googlegroups.com
Ah no wonder!

I was looking at the wrong documentation for asm.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/xInFQ7hCf0c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages