cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
578 stars 7 forks source link

Cursive fails to generate stubs for project after update #1590

Open yareeh opened 7 years ago

yareeh commented 7 years ago

After updating both Cursive and IntelliJ to the latest versions I get this error:

15.04   Error generating stubs for module saldopalvelu: Compiling saldopalvelu.core
            java.lang.NullPointerException, compiling:(expiration.clj:4:27)
            Exception in thread "main" java.lang.NullPointerException, compiling:(expiration.clj:4:27)
            at clojure.lang.Compiler$StaticMethodExpr.eval(Compiler.java:1705)
            at clojure.lang.Compiler$DefExpr.eval(Compiler.java:451)
            at clojure.lang.Compiler.compile1(Compiler.java:7474)
            at clojure.lang.Compiler.compile(Compiler.java:7541)
            at clojure.lang.RT.compile(RT.java:406)
            at clojure.lang.RT.load(RT.java:451)
            at clojure.lang.RT.load(RT.java:419)
            at clojure.core$load$fn__5677.invoke(core.clj:5893)
            at clojure.core$load.invokeStatic(core.clj:5892)
            at clojure.core$load.doInvoke(core.clj:5876)
            at clojure.lang.RestFn.invoke(RestFn.java:408)
            at clojure.core$load_one.invokeStatic(core.clj:5697)
            at clojure.core$load_one.invoke(core.clj:5692)
            at clojure.core$load_lib$fn__5626.invoke(core.clj:5737)
            at clojure.core$load_lib.invokeStatic(core.clj:5736)
            at clojure.core$load_lib.doInvoke(core.clj:5717)
            at clojure.lang.... (show balloon)

The expiration.clj does not have any syntax error and lein run from the command line works just as it did before the IDE and plugin update and is able to compile and run the project.

Cursive version: 1.4.0-2016.3

IntelliJ version: IntelliJ IDEA 2016.3 Build #IU-163.7743.44, built on November 17, 2016 JRE: 1.8.0_112-release-408-b2 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

yareeh commented 7 years ago

Here is the whole expiration.clj file:

(ns saldopalvelu.expiration
  (:require [dotenv.core :as dotenv]))

(def cart-expiration-time (* 1000 60 (:cart-expiration-time-minutes dotenv/env)))
(def locked-order-expiration-time (* 80 60 1000))

(defn calculate-order-expiration-time
  [order cart-timeout locked-ms]
  (let [creation-time (-> :timestamp order .getTime)
        now-time (-> :now order .getTime)
        expiration-time (+ creation-time cart-timeout locked-ms)]
    {:expiration-time expiration-time :db-time now-time}))

(defn is-expired-order? [order cart-timeout locked-ms]
  (let [times (calculate-order-expiration-time order cart-timeout locked-ms)]
    (>= (:db-time times) (:expiration-time times))))

(defn locked-time-ms [shopping-orders locked-orders]
  (let [zipped (apply vector (zipmap (map #(-> :timestamp % .getTime) shopping-orders)
                                     (map #(-> :timestamp % .getTime) locked-orders)))]
    (reduce (fn [memo shopping-to-locked]
                (+ memo (- (first shopping-to-locked) (second shopping-to-locked)))) 0 zipped)))
yareeh commented 7 years ago

This was fixed when I upgraded to

IntelliJ IDEA 2016.3.1 Build #IU-163.9166.20, built on December 6, 2016 Licensed to Reaktor Innovations / Jari Mäkelä Subscription is active until August 31, 2017 JRE: 1.8.0_112-release-408-b2 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o