nasa / fpp

F Prime Prime: A modeling language for F Prime
https://fprime.jpl.nasa.gov
Apache License 2.0
41 stars 31 forks source link

fpp-to-json exits with error when fpp contains boolean #441

Closed mosa11aei closed 1 month ago

mosa11aei commented 1 month ago

Using the non-jvm versions of fpp (i.e., those shipped with F Prime), fpp-to-json errors out when the fpp file contains a boolean constant.

fpp-to-json
module M {
    constant a = true
}

The resulting error looks like:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at fpp.compiler.codegen.AstJsonEncoder$$anon$11.elemEncoders(AstJsonEncoder.scala:29)
    at io.circe.DerivedEncoder.encodeWith(Derivation.scala:237)
    at io.circe.DerivedEncoder.encodeWith$(Derivation.scala:233)
    at fpp.compiler.codegen.AstJsonEncoder$$anon$11.encodeWith(AstJsonEncoder.scala:46)
...
Caused by: java.lang.NoSuchFieldException: 0bitmap$12
    at java.base@11.0.17/java.lang.Class.getDeclaredField(DynamicHub.java:961)
    at scala.runtime.LazyVals$.getOffset(LazyVals.scala:103)
...
bocchino commented 1 month ago

Good catch! We should add this use case to the fpp-to-json unit tests, so the native image tracing will pick it up.