weavejester/cljfmt

NewlineNormalizingReader cannot be converted to IPushbackReader

BrianChevalier opened this issue · 3 comments

I'm receiving the following error on the recently deployed cljfmt (0.8.1) which was not present when using 0.8.0.

We run clojure -M:cljfmt where :cljfmt has the following :main-opts

 :main-opts ["-m" "cljfmt.main" "check" "src"]

Error received (its reporting this for each file checked, I believe)

Failed to format file: src/redacted.clj
java.lang.IllegalArgumentException: 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)
    clojure.tools.reader.reader_types$eval420$fn__421$G__411__428.invoke (reader_types.clj:215)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic (reader_types.clj:379)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invoke (reader_types.clj:371)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic (reader_types.clj:376)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invoke (reader_types.clj:371)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invokeStatic (reader_types.clj:374)
    clojure.tools.reader.reader_types$indexing_push_back_reader.invoke (reader_types.clj:371)
    rewrite_clj.reader$string_reader.invokeStatic (reader.cljc:264)
    rewrite_clj.reader$string_reader.invoke (reader.cljc:261)
    rewrite_clj.parser$parse_string_all.invokeStatic (parser.cljc:42)
    rewrite_clj.parser$parse_string_all.invoke (parser.cljc:39)
    cljfmt.core$reformat_string.invokeStatic (core.cljc:468)
    cljfmt.core$reformat_string.invoke (core.cljc:464)
    cljfmt.main$reformat_string$fn__2694.invoke (main.clj:41)
    cljfmt.core$wrap_normalize_newlines$fn__2341.invoke (core.cljc:492)
    cljfmt.main$reformat_string.invokeStatic (main.clj:41)
    cljfmt.main$reformat_string.invoke (main.clj:40)
    cljfmt.main$check_one.invokeStatic (main.clj:63)
    cljfmt.main$check_one.invoke (main.clj:59)
    clojure.core$partial$fn__5857.invoke (core.clj:2628)
    clojure.core$map$fn__5884.invoke (core.clj:2759)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
    clojure.lang.RT.seq (RT.java:535)
    clojure.core$seq__5419.invokeStatic (core.clj:139)
    clojure.core$map$fn__5884.invoke (core.clj:2750)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
    clojure.lang.RT.seq (RT.java:535)
    clojure.core$seq__5419.invokeStatic (core.clj:139)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:24)
    clojure.core.protocols$fn__8168.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8110$G__8105__8123.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6826)
    clojure.core$reduce.invoke (core.clj:6812)
    cljfmt.main$check.invokeStatic (main.clj:123)
    cljfmt.main$check.invoke (main.clj:110)
    cljfmt.main$_main.invokeStatic (main.clj:222)
    cljfmt.main$_main.doInvoke (main.clj:211)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

Looks like there are some significant breakages with 0.8.1. I'm looking into it.

I'm getting something that seems vaguely related - it's also triggering an exception out of reader_types - when running on OpenJDK 18.0.1 on an M1 Mac.

{:clojure.main/message
 "Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).\nclojure.tools.reader.reader_types.Reader\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.ClassNotFoundException,
  :clojure.error/line 641,
  :clojure.error/cause "clojure.tools.reader.reader_types.Reader",
  :clojure.error/symbol
  jdk.internal.loader.BuiltinClassLoader/loadClass,
  :clojure.error/source "BuiltinClassLoader.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.lang.NoClassDefFoundError,
    :message "clojure/tools/reader/reader_types/Reader",
    :at [java.lang.ClassLoader defineClass1 "ClassLoader.java" -2]}
   {:type java.lang.ClassNotFoundException,
    :message "clojure.tools.reader.reader_types.Reader",
    :at
    [jdk.internal.loader.BuiltinClassLoader
     loadClass
     "BuiltinClassLoader.java"
     641]}],
  :trace
  [[jdk.internal.loader.BuiltinClassLoader
    loadClass
    "BuiltinClassLoader.java"
    641]
   [jdk.internal.loader.ClassLoaders$AppClassLoader
    loadClass
    "ClassLoaders.java"
    188]
   [java.lang.ClassLoader loadClass "ClassLoader.java" 521]
   [java.lang.ClassLoader defineClass1 "ClassLoader.java" -2]
   [java.lang.ClassLoader defineClass "ClassLoader.java" 1013]
   [java.security.SecureClassLoader
    defineClass
    "SecureClassLoader.java"
    150]
   [jdk.internal.loader.BuiltinClassLoader
    defineClass
    "BuiltinClassLoader.java"
    862]
   [jdk.internal.loader.BuiltinClassLoader
    findClassOnClassPathOrNull
    "BuiltinClassLoader.java"
    760]
   [jdk.internal.loader.BuiltinClassLoader
    loadClassOrNull
    "BuiltinClassLoader.java"
    681]
   [jdk.internal.loader.BuiltinClassLoader
    loadClass
    "BuiltinClassLoader.java"
    639]
   [jdk.internal.loader.ClassLoaders$AppClassLoader
    loadClass
    "ClassLoaders.java"
    188]
   [java.lang.ClassLoader loadClass "ClassLoader.java" 521]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [rewrite_clj.reader$fn__754 <clinit> "reader.cljc" 217]
   [rewrite_clj.reader__init load nil 1]
   [rewrite_clj.reader__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 421]
   [rewrite_clj.node.whitespace$loading__6737__auto____630
    invoke
    "whitespace.cljc"
    1]
   [rewrite_clj.node.whitespace__init load nil 1]
   [rewrite_clj.node.whitespace__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 436]
   [rewrite_clj.node.meta$loading__6737__auto____628
    invoke
    "meta.cljc"
    1]
   [rewrite_clj.node.meta__init load nil 1]
   [rewrite_clj.node.meta__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 2422]
   [rewrite_clj.node.coercer$loading__6737__auto____177
    invoke
    "coercer.cljc"
    1]
   [rewrite_clj.node.coercer__init load nil 1]
   [rewrite_clj.node.coercer__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 2793]
   [rewrite_clj.node$loading__6737__auto____175 invoke "node.cljc" 2]
   [rewrite_clj.node__init load nil 2]
   [rewrite_clj.node__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 482]
   [cljfmt.core$loading__6737__auto____173 invoke "core.cljc" 1]
   [cljfmt.core__init load nil 1]
   [cljfmt.core__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 551]
   [cljfmt.main$loading__6737__auto____171 invoke "main.clj" 1]
   [cljfmt.main__init load nil 1]
   [cljfmt.main__init <clinit> nil -1]
   [java.lang.Class forName0 "Class.java" -2]
   [java.lang.Class forName "Class.java" 488]
   [java.lang.Class forName "Class.java" 467]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForName "RT.java" 2218]
   [clojure.lang.RT loadClassForName "RT.java" 2237]
   [clojure.lang.RT load "RT.java" 449]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "clojure.tools.reader.reader_types.Reader"}}

I've released 0.8.2. This should solve the problem, @BrianChevalier and @coyotesqrl. It looks like the cause of the problem was commit 8a22ab2.