Uploaded image for project: 'Clojure'
  1. CLJ-1001

Proxy cannot call proper super-class method

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: Release 1.3, Release 1.2
    • Fix versions: None
    • Labels:
    • Environment:

      Linux herberteuler 3.2.0-2-amd64 #1 SMP Sat May 12 23:08:28 UTC 2012 x86_64 GNU/Linux

      Description

      Attached is a program that reproduces this issue. We have a proxy, `p', which sub-classes java.io.InputStream. There are three methods named `read' in java.io.InputStream: abstract int read(); int read(byte[] b); and int read(byte[] b, int off, int len); see http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html. In the definition of proxy `p', we implement the abstract variant of method `read', making `p' a concrete instance of java.io.InputStream.

      The first invocation, (. p read), returns -1, which is expected.

      The second invocation, (. p (read b 0 n)), should call int read(byte[] b, int off, int len); in java.io.InputStream. But these are actual behavior:

      $ clojure1.2 ~/tmp/proxy-bug.clj
      Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args (4) passed to: user$eval1$fn (proxy-bug.clj:0)
      at clojure.lang.Compiler.eval(Compiler.java:5441)
      at clojure.lang.Compiler.load(Compiler.java:5858)
      at clojure.lang.Compiler.loadFile(Compiler.java:5821)
      at clojure.main$load_script.invoke(main.clj:221)
      at clojure.main$script_opt.invoke(main.clj:273)
      at clojure.main$main.doInvoke(main.clj:354)
      at clojure.lang.RestFn.invoke(RestFn.java:408)
      at clojure.lang.Var.invoke(Var.java:365)
      at clojure.lang.AFn.applyToHelper(AFn.java:161)
      at clojure.lang.Var.applyTo(Var.java:482)
      at clojure.main.main(main.java:37)
      Caused by: java.lang.IllegalArgumentException: Wrong number of args (4) passed to: user$eval1$fn
      at clojure.lang.AFn.throwArity(AFn.java:437)
      at clojure.lang.AFn.invoke(AFn.java:51)
      at user.proxy$java.io.InputStream$0.read(Unknown Source)
      at user$eval1.invoke(proxy-bug.clj:9)
      at clojure.lang.Compiler.eval(Compiler.java:5425)
      ... 10 more

      $ clojure1.2 ~/tmp/proxy-bug.clj
      Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args (4) passed to: user$eval1$fn (proxy-bug.clj:0)
      at clojure.lang.Compiler.eval(Compiler.java:5441)
      at clojure.lang.Compiler.load(Compiler.java:5858)
      at clojure.lang.Compiler.loadFile(Compiler.java:5821)
      at clojure.main$load_script.invoke(main.clj:221)
      at clojure.main$script_opt.invoke(main.clj:273)
      at clojure.main$main.doInvoke(main.clj:354)
      at clojure.lang.RestFn.invoke(RestFn.java:408)
      at clojure.lang.Var.invoke(Var.java:365)
      at clojure.lang.AFn.applyToHelper(AFn.java:161)
      at clojure.lang.Var.applyTo(Var.java:482)
      at clojure.main.main(main.java:37)
      Caused by: java.lang.IllegalArgumentException: Wrong number of args (4) passed to: user$eval1$fn
      at clojure.lang.AFn.throwArity(AFn.java:437)
      at clojure.lang.AFn.invoke(AFn.java:51)
      at user.proxy$java.io.InputStream$0.read(Unknown Source)
      at user$eval1.invoke(proxy-bug.clj:9)
      at clojure.lang.Compiler.eval(Compiler.java:5425)
      ... 10 more

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: