Fork me on GitHub
#cursive
<
2019-02-01
>
kenny16:02:21

I'm running into a pretty nasty IntelliJ/Cursive bug. I am editing a deftype when I get an IDE error (I submitted one to Cursive, I think). Then a couple seconds later I get a IDE and Plugin Updates message. A couple seconds after that, I can no longer edit my file or close IntelliJ. I have to log out and log back in to get IntelliJ to quit.

kenny16:02:52

The deftype looks like this:

(deftype PointTimestampExtractor []
  TimestampExtractor
  (^long extract [_ ^ConsumerRecord record ^long previousTimeStamp]
    (let [{:keys [point]} (.value record)]
      (long (first point)))))

manutter5116:02:01

Sounds nasty, have you tried File->Invalidate Caches & Restart...?

kenny16:02:38

No. Not sure how that would help here. It isn't a problem with resolving stuff. I guess I could try it though.

manutter5116:02:09

I'm just thinking it sounds like something is majorly corrupted somewhere, cache clearing might help? 🤞

5
kenny16:02:28

Trying now 🙂

kenny16:02:56

I think I've had problems with editing deftypes in the past too. None that cause a full editor crash like this though.

Alex Miller (Clojure team)16:02:33

that ^long return type looks wrong

kenny16:02:08

Where should it go?

Alex Miller (Clojure team)16:02:27

the signature of extract is defined in TimestampExtractor - that’s what you’re going to get

kenny16:02:42

Right, makes sense. Maybe that's causing an issue.

Alex Miller (Clojure team)16:02:28

the type hints in the signature won’t affect the method signature (again, you’ll get whatever extract is defined as) but do help the interop inside the method

Alex Miller (Clojure team)16:02:11

although I guess previousTimeStamp isn’t being used, so not gaining anything there

kenny16:02:54

TBH it's mostly helpful for documentation.

kenny16:02:22

It just happened again - after Invalidate caches & fixing that type hint. The exception reported says it is #131. This time no IDE crash but editing in and around the deftypes acts very strangely. For example, if I put my cursor at the end of the deftype and hit enter, it will indent to the starting paren here (long.

kenny16:02:04

Backspace doesn't work around the deftypes either.

kenny16:02:35

Opening and closing the file doesn't help. Editing anything above the deftype form but below the form above the deftype and anything below the deftype form but above the form below it causes the strange indent & no backspace issue.

kenny16:02:39

Closing and reopening the project doesn't help. Even restarting the IDE doesn't do it.

joelsanchez18:02:35

is there any refactor for moving vars in cursive?

cfleming19:02:14

@kenny That does sound nasty, sorry - I’ve looked at the error, it’s a StackOverflowError. I can’t immediately see the cause, sorry. The class definition code did change in the latest EAP, downgrading to the latest stable might help until I can look at it?

cfleming19:02:00

SOEs are really nasty, they can cause the JVM to hold onto monitor objects forever and other seemingly impossible things.

cfleming19:02:46

@joelsanchez No sorry, although there should be.

joelsanchez20:02:07

any plans to add it? it could be like this: - move the def to the end of target ns - require the new ns in the namespaces that use the var (if needed), and allow the user to decide if Cursive should use a :refer or an :alias - (possibly) remove requires of the old ns if it's not used anymore