Fork me on GitHub
#rewrite-clj
<
2022-02-03
>
cddr12:02:31

Morning folks, my lovely tree-transformer from a couple of weeks ago (which is really just a thin wrapper around clj-rewrite’s walker) works fine when I run using “lein run”. However, our app is deployed via this jlib plugin that builds layered images rather stuffing the uberjar onto an image and running it. (new to me but seems intended to build more efficient images). Anyway, when I run the app via this image, I get the following error when invoking “ofString” to get the clj-zipper.

Argument of type: class rewrite_clj.reader.NewlineNormalizingReader cannot be converted to IPushbackReader
    at clojure.tools.reader.reader_types$eval439$fn__440.invoke(reader_types.clj:223)
	at clojure.tools.reader.reader_types$eval420$fn__421$G__411__428.invoke(reader_types.clj:215)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:379)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:376)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:374)
	at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371)
	at rewrite_clj.reader$string_reader.invokeStatic(reader.cljc:264)
	at rewrite_clj.reader$string_reader.invoke(reader.cljc:261)
	at rewrite_clj.parser$parse_string_all.invokeStatic(parser.cljc:42)
	at rewrite_clj.parser$parse_string_all.invoke(parser.cljc:39)
	at rewrite_clj.zip.base$of_string.invokeStatic(base.cljc:93)
	at rewrite_clj.zip.base$of_string.invoke(base.cljc:85)
	at rewrite_clj.zip.base$of_string.invokeStatic(base.cljc:91)
	at rewrite_clj.zip.base$of_string.invoke(base.cljc:85)
	at rewrite_clj.zip$of_string.invokeStatic(zip.cljc:264)
	at rewrite_clj.zip$of_string.invoke(zip.cljc:258)
Anyone have any clues as to how I might fix this?

wilkerlucio18:03:55

hello folks, I'm having a similar issue to this one, but in my case is while trying to use cljstyle (which uses rewrite-clj under the hood), I saw @cddr you said something about conflicting dependencies, but in my case the cljstye is everything I put, I'm running with this: clojure -Sdeps "{:deps {mvxcvi/cljstyle {:mvn/version \"0.15.0\"}}}" -m cljstyle.main check src test

wilkerlucio18:03:19

I'm pretty sure this command used to work in the past, but for some reason now I get:

java.lang.IllegalArgumentException: Argument of type: class rewrite_clj.reader.NewlineNormalizingReader cannot be converted to IPushbackReaderError while processing file src/dev/dev_extras.clj
java.lang.IllegalArgumentException: Argument of type: class rewrite_clj.reader.NewlineNormalizingReader cannot be converted to IPushbackReaderError while processing file test/integration/member_flow.clj
java.lang.IllegalArgumentException: Argument of type: class rewrite_clj.reader.NewlineNormalizingReader cannot be converted to IPushbackReaderError while processing file test/integration/health_check_flow.clj
...

wilkerlucio18:03:03

checking the deps tree, it seems to be using the correct version of org.clojure/tools.reader 1.3.6

wilkerlucio19:03:57

thanks man, I considered that, but in my case there is no clojurescript in the game, wonder if there are any other ideas out there

lread21:03:56

@U066U8JQJ if you try from the same dir:

clojure -Sdeps "{:deps {mvxcvi/cljstyle {:mvn/version \"0.15.0\"}}}" -Stree
You might maybe see another older version of rewrite-clj/rewrite-cljs? (`-Sdeps` are merged after your project deps)

wilkerlucio21:03:16

humm, good point, I tough -Sdeps would replace the deps completely

wilkerlucio21:03:26

using an alias with :replace-deps I got it to work fine

wilkerlucio21:03:40

do you know if there is a way to replace strait from teh command line (so I wouldn't need the alias)?

lread21:03:58

Hmmm… dunno. Without thinking about it too much… would a :replace-deps not work from the cmd line?

wilkerlucio21:03:26

if that count as an alias, maybe, let me try 🙂

lread21:03:38

If cljstyle installs as a clojure tool that might be another route.

wilkerlucio21:03:56

found a thing that works, ugly, but works 😛 clojure -Sdeps "{:aliases {:cljstyle {:replace-deps {mvxcvi/cljstyle {:mvn/version \"0.15.0\"}}}}}" -M:cljstyle -m cljstyle.main check src test

lread21:03:13

Oh right, of course… :replace-deps only works in aliases!

borkdude12:02:57

Can you make a repro + issue?

lread13:02:34

That's a new one to me as well @cddr looking forward to learning more.

slimslenderslacks22:02:45

@cddr I can also help if this turns out to be a classloader problem resulting from the how the image was constructed. The set of jars on your classpath should be pretty close to what you get from lein run but I guess you're also maintaining a deps.edn too right?

wilkerlucio18:03:55
replied to a thread:Morning folks, my lovely tree-transformer from a couple of weeks ago (which is really just a thin wrapper around clj-rewrite’s walker) works fine when I run using “lein run”. However, our app is deployed via this jlib plugin that builds layered images rather stuffing the uberjar onto an image and running it. (new to me but seems intended to build more efficient images). Anyway, when I run the app via this image, I get the following error when invoking “ofString” to get the clj-zipper. Argument of type: class rewrite_clj.reader.NewlineNormalizingReader cannot be converted to IPushbackReader at clojure.tools.reader.reader_types$eval439$fn__440.invoke(reader_types.clj:223) at clojure.tools.reader.reader_types$eval420$fn__421$G__411__428.invoke(reader_types.clj:215) at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:379) at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371) at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:376) at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371) at clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic(reader_types.clj:374) at clojure.tools.reader.reader_types$indexing_push_back_reader.invoke(reader_types.clj:371) at rewrite_clj.reader$string_reader.invokeStatic(reader.cljc:264) at rewrite_clj.reader$string_reader.invoke(reader.cljc:261) at rewrite_clj.parser$parse_string_all.invokeStatic(parser.cljc:42) at rewrite_clj.parser$parse_string_all.invoke(parser.cljc:39) at rewrite_clj.zip.base$of_string.invokeStatic(base.cljc:93) at rewrite_clj.zip.base$of_string.invoke(base.cljc:85) at rewrite_clj.zip.base$of_string.invokeStatic(base.cljc:91) at rewrite_clj.zip.base$of_string.invoke(base.cljc:85) at rewrite_clj.zip$of_string.invokeStatic(zip.cljc:264) at rewrite_clj.zip$of_string.invoke(zip.cljc:258) Anyone have any clues as to how I might fix this?

hello folks, I'm having a similar issue to this one, but in my case is while trying to use cljstyle (which uses rewrite-clj under the hood), I saw @cddr you said something about conflicting dependencies, but in my case the cljstye is everything I put, I'm running with this: clojure -Sdeps "{:deps {mvxcvi/cljstyle {:mvn/version \"0.15.0\"}}}" -m cljstyle.main check src test