lightbend / kalix-jvm-sdk

Java and Scala SDKs for Kalix
https://docs.kalix.io/java/index.html
Other
57 stars 38 forks source link

None.get exception in ValueEntitySourceGenerator when `state` is simple type like String #624

Open jrudolph opened 2 years ago

jrudolph commented 2 years ago

It doesn't seem to be supported (any more) to use a simple type like String as state of (at least) value entities.

Is that something we want to support? If not we should provide a better error message.

java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:529)
    at scala.None$.get(Option.scala:527)
    at com.lightbend.akkasls.codegen.FullyQualifiedName.descriptorImport$lzycompute(Packaging.scala:50)
    at com.lightbend.akkasls.codegen.FullyQualifiedName.descriptorImport(Packaging.scala:50)
    at com.akkaserverless.codegen.scalasdk.impl.ValueEntitySourceGenerator$.$anonfun$provider$3(ValueEntitySourceGenerator.scala:136)
    at scala.collection.immutable.List.map(List.scala:293)
    at com.akkaserverless.codegen.scalasdk.impl.ValueEntitySourceGenerator$.provider(ValueEntitySourceGenerator.scala:136)
    at com.akkaserverless.codegen.scalasdk.impl.ValueEntitySourceGenerator$.generateManaged(ValueEntitySourceGenerator.scala:32)
    at com.akkaserverless.codegen.scalasdk.impl.SourceGenerator$.$anonfun$generateManaged$1(SourceGenerator.scala:34)
raboof commented 2 years ago

This is because it's trying to load a descriptor for something that isn't defined in a proto file - I think https://github.com/lightbend/akkaserverless-java-sdk/pull/620/files#diff-a1452ea66140726924f5cfb17d413b96cc9d0092d2ac5259c3e35b5cc06d48d4R149 makes sense to do here as well.

(this code previously assumed all 'relevant' types came from descriptors, which isn't the case here)