I
strongly suggest you to start with Gradle or SBT plugin to make
proof-of-concept and then write your own builder based on TeaVMTool.
I already browsed related classes and kept an eye on TeaVMTool when configuring, I try to ask only what remains unclear regarding the concepts of TeaVM internals.
I fixed the logging, now its rendered using
TeaVMProblemRenderer.describeProblems(vm, log)
instead of getProblemProvider.getProblems.asScala ... foreach(println)
I added teavm-classlib, though the issue persists.
I try to summarize the error log effectively:
There are two kinds of errors in the log, it's Method not found, and Substitutor for bootstrap method not found
Now I see a call log below the error messages, here are two examples:
ERROR: Method java.lang.invoke.MethodHandle.invoke()V was not found
at scala.runtime.Statics.releaseFence(Statics.java:148)
at Hello$.<clinit>((inline):2)
at Hello.main(-1)
ERROR: Substitutor for bootstrap method java.lang.invoke.LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; was not found
at scala.App.main(App.scala:98)
at scala.App.main$(App.scala:96)
at Hello$.main((inline):1)
at Hello.main(-1)
What is common is that all call logs originate from the entrypoint Hello.main, and mention that a java.lang.invoke.* method is missing.
My findings and what I do not understand conceptually are:
- What is supposed to be a substitutor for a bootstrap method? Is it a T prefixed class from teavm-classlib
- My classloader had to serve java.lang.invoke.* classes, and according to logs, it did successfully, though there were no lookups for T prefixed classes logged by the classloader
So, to wrap up, though I actively browse existing code, I think I'll need to understand the above-mentioned concepts to create an embedded on-the-fly generator.
I can't make a promise regarding that, but such working solutions can attract Scala users, I hope I can implement this.