Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Is there support for scala 2.10 ?
    Daniela Sfregola
    Hi @anchika, unfortunately we do not support scala 2.10
    Thomas Heslin
    Hi. I’m having an issue, it may be with ScalaCheck, i’m not sure. I have a trait Creature with a number of implementations. I have an Arbitrary[Creature] which has been working for many months. I recently added a new field and around time time I started getting the following errors if I run forAll { creature: Creature =>
    [info]   NullPointerException was thrown during property evaluation.
    [info]     Message: "None"
    [info]     Occurred when passed generated values (
    [info]     )
    and if I just run random[Creature] I get:
    com.danielasfregola.randomdatagenerator.magnolia.RandomDataException: Could not generate a random value for io.github.tjheslin1.dmspredictor.model.Creature.
    [info] Please, make use that the Arbitrary instance for type io.github.tjheslin1.dmspredictor.model.Creature is not too restrictive
    [info]   at com.danielasfregola.randomdatagenerator.magnolia.RandomDataGenerator.explode(RandomDataGenerator.scala:30)
    [info]   at com.danielasfregola.randomdatagenerator.magnolia.RandomDataGenerator.random(RandomDataGenerator.scala:21)
    [info]   at com.danielasfregola.randomdatagenerator.magnolia.RandomDataGenerator.random$(RandomDataGenerator.scala:17)
    [info]   at unit.rogue.BaseRogueAbilitiesSpec.random(BaseRogueAbilitiesSpec.scala:13)
    [info]   at com.danielasfregola.randomdatagenerator.magnolia.RandomDataGenerator.random(RandomDataGenerator.scala:15)
    [info]   at com.danielasfregola.randomdatagenerator.magnolia.RandomDataGenerator.random$(RandomDataGenerator.scala:15)
    [info]   at unit.rogue.BaseRogueAbilitiesSpec.random(BaseRogueAbilitiesSpec.scala:13)
    [info]   at unit.rogue.BaseRogueAbilitiesSpec$$anon$4.<init>(BaseRogueAbilitiesSpec.scala:83)
    [info]   at unit.rogue.BaseRogueAbilitiesSpec.$anonfun$new$9(BaseRogueAbilitiesSpec.scala:80)
    [info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
    I’ve ruled out the new field
    Thomas Heslin
    I’ve tried printing out all the generated values created in a for comprehension. These all give valid values. It’s inside the yield that it seems to fail
    Thomas Heslin
    I’ve put all the related arbitary definitions in a gist
    Thomas Heslin
    I figured out that the issue was in fact the new field. I was referencing the field in the trait to calculate a constant
    Daniela Sfregola
    Hi @tjheslin1, apologies for missing your message! Yes, the exception indicates that ScalaCheck doesn't have a rule to generate a random instance of a certain type
    ....I am glad you managed to figure it out!
    Ryan Stull


    I have a case class that I'm trying to generate instances for which has 70 fields, and I'm getting this error:

    Error:scalac: Error while emitting main/Main$$typecreator1$1
    Method too large: main/Main$$typecreator1$1.apply (Lscala/reflect/api/Mirror;)Lscala/reflect/api/Types$TypeApi;

    Does anyone know if there is a way to work around this?

    I tried this with both the shapeless and magnolia version and got the same error
    I'm using this version libraryDependencies += "com.danielasfregola" %% "random-data-generator-magnolia" % "2.8"
    Daniela Sfregola
    Hi @ryanstull a quick workaround would be to write manually the Arbitrary instance for this super big case class - quick I guess it is super painful
    I'll try to have a look, but this could be an issue with the scala compiler - it may be worth it creating a ticket under scala/scala