Fork me on GitHub
#babashka
<
2023-06-17
>
timo10:06:53

I am getting No matching ctor found for class java.util.Date when using Date with millis like (Date. millis). I don't understand what's wrong here. I am sure it is a long that I am passing. EDIT: This is a pod so more of a graalvm-question. But inside the pod when compiled I can not call Date with milliseconds. 😕

timo11:06:54

is it not implemented with this constructor?

timo11:06:22

How would you serialize/deserialize a Date?

borkdude11:06:42

This is a reflection issue:

user=> (set! *warn-on-reflection* true)
true
user=> (def x 1)
#'user/x
user=> (java.util.Date. x)
Reflection warning, NO_SOURCE_PATH:1:1 - call to java.util.Date ctor can't be resolved.
#inst "1970-01-01T00:00:00.001-00:00"

borkdude11:06:55

if you fix that it will work in the pod

borkdude11:06:32

serialization: if you use transit as the pod payload format, then it'll work out of the box

fjsousa13:06:06

hey, getting some duplicate notifications with fs watcher, not sure what I'm missing here. EDIT: with :recursive true

[fsousa@work fs-watch-issue]$ ls
bb.edn

[fsousa@work fs-watch-issue]$ cat bb.edn 
{:paths ["src"]
 :pods {org.babashka/fswatcher {:version "0.0.3"}}
 :tasks
 { watch {:requires ([pod.babashka.fswatcher :as fw]
                     [babashka.fs :as fs])
                :task (do (fw/watch "." prn {:recursive true :delay-ms 500})
                          (deref (promise)))}}}

[fsousa@work fs-watch-issue]$ bb watch #Then I just added a new line to bb.end and saved once
{:type :write, :path "./bb.edn"}
{:type :write, :path "bb.edn"}
{:type :write, :path "./bb.edn"}
{:type :write, :path "bb.edn"}

borkdude13:06:49

fswatcher is just a thin wrapper around the golang library, so whatever behavior you get from that library, you get with the pod

borkdude13:06:59

maybe upgrading the go lib helps, not sure

borkdude13:06:07

are you on windows?

borkdude13:06:27

doesn't look like it, just double checking

fjsousa13:06:36

let me try to run the go code see if I get the same result

fjsousa13:06:00

I could avoid this by adding multiple watchers, it's just that it would be cleaner to have a single one

fjsousa13:06:47

ok right away there's mentioning of dups

[fsousa@work fsnotify]$ go run ./cmd/fsnotify
# ...
fsnotify is a Go library to provide c

    watch [paths]  Watch the paths for changes and print the events.
    file  [file]   Watch a single file for changes.
    dedup [paths]  Watch the paths for changes, suppressing duplicate events.

borkdude13:06:22

ah, does the API provide a way to suppress those?

borkdude13:06:33

then PR welcome, we could expose it

fjsousa13:06:17

why would it emit dups in the first place?

borkdude13:06:58

I don't know, it's annoying isn't it. We could dedupe by default and if users pass false, we'll undo it?

fjsousa13:06:19

seems like a valid strategy

borkdude15:06:51

ok, could you open an issue about it (PR optional, but welcome)

fjsousa18:06:39

created the issue with some findings