Fork me on GitHub
#interop
<
2019-07-01
>
Alex Miller (Clojure team)13:07:48

could you drop the first 10 lines or so of the stack trace? (pst)

Alex Miller (Clojure team)13:07:17

what jvm were the protobuff objects compiled with?

dharrigan13:07:48

I shall, and JVM 1.8

Alex Miller (Clojure team)13:07:29

so java modules were added in Java 1.9, not sure if that's involved here (doesn't really look like it from the message)

dharrigan13:07:42

IllegalAccessError tried to access field com.google.protobuf.AbstractMessage.memoizedSize from class com.foo.Foo$Bar
        com.foo.Foo$Bar.getSerializedSize (DQAProto.java:7881)
        com.google.protobuf.AbstractMessageLite.toByteArray (AbstractMessageLite.java:62)
        message_window_enricher.interop.Interop.messageWindowToBytes (Interop.kt:12)
        user/eval32140 (NO_SOURCE_FILE:1)
        user/eval32140 (NO_SOURCE_FILE:1)
        clojure.lang.Compiler.eval (Compiler.java:7177)
        clojure.lang.Compiler.eval (Compiler.java:7132)
        clojure.core/eval (core.clj:3214)
        clojure.core/eval (core.clj:3210)
        clojure.main/repl/read-eval-print--9086/fn--9089 (main.clj:437)
        clojure.main/repl/read-eval-print--9086 (main.clj:437)
        clojure.main/repl/fn--9095 (main.clj:458)

Alex Miller (Clojure team)13:07:43

I'm kind of wondering if you'd have same result if you had compiled the protobuf object w/Java 12

dharrigan13:07:06

Thing is, I have a project, in pure java 1.8, does the same thing, works fine. Even when I switch the project to java 12, works fine

dharrigan13:07:16

only in Clojure am I seeing this issue.

dharrigan13:07:30

kotlin both when compiling to java 1.6 and 1.8 bytecode, works fine.

Alex Miller (Clojure team)13:07:53

well those symptoms sound like a reflection issue - if you (set! *warn-on-reflection* true), do you see any reflection warnings?

dharrigan13:07:02

No, and I have that on

Alex Miller (Clojure team)14:07:18

reading the error, it sounds like messages can cache the computed size in the private memoizedSize field in the parent abstract class and the child class is unable to access the abstract parent field?

Alex Miller (Clojure team)14:07:41

it's possible this is module related

dharrigan14:07:55

when I switch to java 8, same issue with clojure

dharrigan14:07:04

java 8, kotlin/java == no issue

Alex Miller (Clojure team)14:07:46

the confusing thing here is that the access error seems to be in calls from one external thing to another external thing, not in the Clojure call itself

dharrigan14:07:05

Do you mind if I ping you privately, i.e., company data in error 🙂

Alex Miller (Clojure team)14:07:41

sure, although not sure how much time I have to look at it

dharrigan14:07:15

I appreciate it - I hope it's something trivial and not a compiler bug

dharrigan15:07:31

So, a huge thank you to Alex who helped me to get a solution to my problem by pointing the finger!

dharrigan15:07:16

I had a rogue import of a protobuf library all the way from rebel readline which included the cljs libraries which included the closure compiler which included a version of protobuf that I am not using!

dharrigan15:07:51

this solved the problem

dharrigan15:07:53

:rebel {:extra-deps {com.bhauman/rebel-readline {:mvn/version "RELEASE" :exclusions [org.clojure/google-closure-library
                                                                                       rewrite-cljs/rewrite-cljs]}}

dharrigan15:07:05

May your fame increase a million fold Alex!

Alex Miller (Clojure team)15:07:57

btw, it's a bad idea to use RELEASE versions, much better to set a fixed version

dharrigan15:07:17

yes, thank you. Learning as I go 🙂

dharrigan15:07:29

Your recommendation of using jhades helped tremendously

Alex Miller (Clojure team)15:07:33

cool. I think there's some clojure lein plugin that does something similar too, but can't remember what it's called

dharrigan15:07:05

I'll keep it in mind if I come across similar issues

dharrigan15:07:23

(I'm getting a few use cases together for the adoption of clojure at work)

ghadi15:07:29

JHades seems useful

dharrigan15:07:32

so translating one kotlin project to clojure will help 🙂

seancorfield16:07:59

(I just added the Zulip mirror bot so future discussions here will be archived and searchable within Zulip -- I didn't even know this channel existed!)

aisamu09:07:59

Came here to do precisely that, thank you!