3

I have Clojure function that returns a LazySeq. When I run this function from the REPL, it works just fine. However, if I try to call the same function from Java code like this:

Object result = com.acme.forecast.core.runforecast("file1.csv", "file2.txt");

I get the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
  clojure.lang.LazySeq cannot be cast to java.lang.Number
    at com.acme.forecast.core.runforecast(Unknown Source)
    at com.acme.forecast.client.gui.ClientGUI.actionPerformed(ClientGUI.java:180)

My gen-class says I'm returning a LazySeq, not a Number:

  (:gen-class
    :name com.acme.forecast.core
    :methods [#^{:static true} [runforecast [String String] clojure.lang.LazySeq]])

What is going wrong here?

Paul Reiners
  • 8,576
  • 33
  • 117
  • 202

2 Answers2

3

The error does say you're returning LazySeq. The problem is that it's trying to get stored in a Number, though I can't see where in this code segment.

Thomas
  • 5,074
  • 1
  • 16
  • 12
1

Never mind. I found the problem. There was an old version of the .class file lying around.

Paul Reiners
  • 8,576
  • 33
  • 117
  • 202