I'm not sure if this is a problem with borer. It may just be a Scala 3/Java API issue dealing with inline functions or macros.
I am getting an error when a Java-17 function calls the "encoder()" method on the Codec class:
[error] /testDir/scala3-test/src/main/scala/csw/params/Test.java:7:1: cannot access io.bullet.borer.Encoder
[error] bad class file: /home/user/.cache/coursier/v1/https/repo1.maven.org/maven2/io/bullet/borer-core_3/1.11.0/borer-core_3-1.11.0.jar(/io/bullet/borer/Encoder.class)
[error] undeclared type variable: B
[error] Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Test {
public void shouldConvertPmToFromJSON() {
var pm = new ProperMotion(0.5, 2.33);
var pmjs = JsonSupport.writes(pm, ProperMotion.properMotionCodec().encoder());
}
}
I'm not sure if this is a problem with borer. It may just be a Scala 3/Java API issue dealing with inline functions or macros. I am getting an error when a Java-17 function calls the "encoder()" method on the Codec class:
I created a simple test repo that demonstrates the problem: https://github.com/abrighton/scala3-test
See also https://stackoverflow.com/questions/76850920/java-class-calling-scala-3-macro-gets-bad-class-file-undeclared-type-variabl
The Scala class:
The Java class:
And deriveCodec from borer looks like this:
The class file is not corrupted (I have tested with multiple versions). This seems to be an issue with Java calling an inline Scala function.
The Scala version compiles:
This type of code compiled previously under Scala-2.13. Any ideas what the problem might be?