cursive-ide / cursive

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

`Syntax error compiling at (cheshire/generate.clj:1:1)` when refreshing Leiningen projects #2208

Closed luontola closed 5 years ago

luontola commented 5 years ago

I'm getting the following error in the Event Log when pressing the Refresh Leiningen Projects button and as a result none of the project dependencies are resolved.

Error reading /Users/esko/devel/rems/project.clj
Syntax error compiling at (cheshire/generate.clj:1:1).
java.sql.Timestamp

The project in question is here: https://github.com/CSCfi/rems/blob/master/project.clj

IntelliJ IDEA 2019.2 (Ultimate Edition), Build #IU-192.5728.98 Cursive 1.8.2-2019.2

luontola commented 5 years ago

Downgrading to IDEA 2019.1.3 (IU-191.7479.19) and Cursive v1.8.2-2019.1 avoids the problem.

bcachet commented 5 years ago

Hello,

I have same issue

Error reading /home/bertrand/Workspace/Code/potos/project.clj
Syntax error compiling at (mranderson048/toolsreader/v1v1v1/clojure/tools/reader/default_data_readers.clj:1:1).
java.sql.Timestamp

In the meantime I will downgrade to IDEA 2019.1.3

cursive-ide commented 5 years ago

I suspect that this issue is actually caused by using IntelliJ running on a JDK 11 JRE. There are now two options when downloading IntelliJ, but it looks like the default uses JDK 11 and to get the JDK 8 version you have to click "Other versions" when downloading.

@bcachet I'm also a little concerned to see mranderson in your error, that probably means that you have some CIDER stuff kicking around, which might cause problems. I don't think it causes this problem, but the CIDER middleware does interfere with Cursive sometimes.

aventinesolutions commented 5 years ago

I am getting this problem as well (Syntax error compiling at (cheshire/generate.clj:1:1). This happens in my ClojureScript ("figwheel") project.clj stub generation, but not it does not occur for the corresponding Clojure backend.

Reading your note above, I tried three different JDK's, all with the same result. AdoptOpen JDK 8:

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)

AdoptOpen JDK 9:

openjdk version "9"
OpenJDK Runtime Environment (build 9+181)
OpenJDK 64-Bit Server VM (build 9+181, mixed mode)

AdopyOpen JDK 12:

openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.1+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.1+12, mixed mode, sharing)

I am on:

macOS Mojave 10.14.5
Homebrew 2.1.8
IntelliJ IDEA 2019.2 (Ultimate Edition)
Build #IU-192.5728.98, built on July 23, 2019
Runtime version: 11.0.3+12-b304.10 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12

Thanks Colin, by the way, for a fantastic plugin.

cursive-ide commented 5 years ago

@aventinesolutions So I think you're talking about the JDK you're using with your project, correct? I think this problem is instead provoked by the JRE used to run IntelliJ itself, which is bundled within it. In your version details, that's this bit: Runtime version: 11.0.3+12-b304.10 x86_64. In order to try the JDK8 version, you'll have to download IntelliJ using the "Other versions" link as detailed in my comment above.

Thanks for the kind words!

markbastian commented 5 years ago

I am also getting this error when loading any Clojure project with IntelliJ 2019.2 and the latest Cursive plugin. For example, when loading this project https://github.com/markbastian/clj-cloud-playground/blob/master/project.clj I get the following error:

Error reading /Users/mbastian/workspace/clj-cloud-playground/project.clj
            Syntax error compiling at (mranderson048/toolsreader/v1v1v1/clojure/tools/reader/default_data_readers.clj:1:1).
            java.sql.Timestamp

java --version gives me:

openjdk 12.0.1 2019-04-16
OpenJDK Runtime Environment (build 12.0.1+12)
OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

I also tried switching the boot SDK using these instructions from the default (JDK 11, bundled) to JDK 12 https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under. This hangs IJ startup. I was going to try installing OpenJDK 8 and seeing if that works, but it looks like it might not be trivial for OS X.

For now, I'll just roll my version back. Thanks again for all the hard work on Cursive!

More details...My home computer (Also a Macbook Pro) handled the update just fine with the same project. It is running JDK 11. From java --version:

java 11.0.1 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Lein version is Leiningen 2.9.1 on Java 11.0.1 Java HotSpot(TM) 64-Bit Server VM.

Ok, I figured it out. Something in my profiles.clj file was causing the problem. I did a version upgrade on everything and commented out cider-nrepl and refactor-nrepl to make it align with my other machine. Everything works now. Hopefully this will help someone else down the line.

primaljax commented 5 years ago

It does seem to be JDK 11 related. I worked around this issue by switching the boot JDK in IDEA 2019.2.

Go to Help -> Find Action Search for "Switch Boot JDK" Change the JDK to an older version.

aventinesolutions commented 5 years ago

@cursive-ide Yes, downloading this ideaIU-2019.2-jbr8.dmg version for MacOS fixed the problem indeed. I am back in business. Thanks! 🌞

cursive-ide commented 5 years ago

This is fixed in the next EAP as part of #2239.