You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.util.NoSuchElementException: key not found: test
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
at com.quantifind.sumac.FieldArgs$$anonfun$addAnnotationValidations$1.apply(FieldArgs.scala:56)
at com.quantifind.sumac.FieldArgs$$anonfun$addAnnotationValidations$1.apply(FieldArgs.scala:55)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
at com.quantifind.sumac.FieldArgs$class.addAnnotationValidations(FieldArgs.scala:55)
at MyClass$MyArgs.addAnnotationValidations(<console>:12)
at com.quantifind.sumac.FieldArgs$$anonfun$1.applyOrElse(FieldArgs.scala:18)
at com.quantifind.sumac.FieldArgs$$anonfun$1.applyOrElse(FieldArgs.scala:15)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33)
at scala.collection.TraversableLike$$anonfun$collect$1.apply(TraversableLike.scala:278)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.collect(TraversableLike.scala:278)
at scala.collection.AbstractTraversable.collect(Traversable.scala:105)
at com.quantifind.sumac.FieldArgs$class.getArgs(FieldArgs.scala:15)
at MyClass$MyArgs.getArgs(<console>:12)
at MyClass$MyArgs.getArgs(<console>:12)
at com.quantifind.sumac.Args$class.getArgs(Args.scala:7)
at MyClass$MyArgs.getArgs(<console>:12)
at com.quantifind.sumac.Args$class.parser(Args.scala:28)
at MyClass$MyArgs.parser$lzycompute(<console>:12)
at MyClass$MyArgs.parser(<console>:12)
at com.quantifind.sumac.Args$class.parse(Args.scala:39)
at MyClass$MyArgs.parse(<console>:12)
The text was updated successfully, but these errors were encountered:
The reason for this is that Sumac figures out default values by calling the default (zero-arg) constructor, and grabbing the values from all fields.
However, inner-classes don't actually have a zero-arg constructor -- they really take a reference to the containing class (which java / scala normally take care of for you).
I don't know if there is anything we can do about this ... maybe the only TODO here is to update the docs to say you can't use inner classes. I'd definitely love to hear any ideas on how to fix.
If the
FieldArgs
argument class is defined as an inner class, sumac is ok with it. For instance, with:we can do:
and everything seems to be working.
However, when using annotation for validation:
parse
will throw an exception:The text was updated successfully, but these errors were encountered: