Fields re-initializes generators on each generation
vlsi opened this issue · 2 comments
vlsi commented
Note: gen().field(...)
should not be used in generate
method.
The same goes for __FunctionGenerator and __PredicateGenerator
Stacktrace:
java.lang.Throwable: org.gradle.api.java.archives.internal.generators.RegexStringGenerator@59a6a709.configure(@org.gradle.api.java.archives.internal.generators.Regex(value="[-_a-zA-Z0-9]+"))
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:249)
at org.gradle.api.java.archives.internal.generators.RegexStringGenerator.configure(RegexStringGenerator.groovy:32)
at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.pholser.junit.quickcheck.internal.Reflection.invoke(Reflection.java:170)
at com.pholser.junit.quickcheck.generator.Generator.configure(Generator.java:395)
at com.pholser.junit.quickcheck.generator.Generator.configureStrict(Generator.java:356)
at com.pholser.junit.quickcheck.generator.Generator.configureStrict(Generator.java:349)
at com.pholser.junit.quickcheck.generator.Generator.configure(Generator.java:258)
at com.pholser.junit.quickcheck.internal.generator.CompositeGenerator.configure(CompositeGenerator.java:104)
at com.pholser.junit.quickcheck.generator.ComponentizedGenerator.configure(ComponentizedGenerator.java:101)
at com.pholser.junit.quickcheck.internal.generator.CompositeGenerator.configure(CompositeGenerator.java:104)
at com.pholser.junit.quickcheck.internal.generator.GeneratorRepository.produceGenerator(GeneratorRepository.java:234)
at com.pholser.junit.quickcheck.internal.generator.GeneratorRepository.field(GeneratorRepository.java:173)
at com.pholser.junit.quickcheck.internal.generator.GeneratorRepository.field(GeneratorRepository.java:130)
at org.gradle.api.java.archives.internal.generators.FromFieldGenerator.configure(FromFieldGenerator.java:37)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.pholser.junit.quickcheck.internal.Reflection.invoke(Reflection.java:170)
at com.pholser.junit.quickcheck.generator.Generator.configure(Generator.java:395)
at com.pholser.junit.quickcheck.generator.Generator.configureLenient(Generator.java:378)
at com.pholser.junit.quickcheck.generator.Generator.configureLenient(Generator.java:371)
at com.pholser.junit.quickcheck.generator.Generator.configure(Generator.java:265)
at com.pholser.junit.quickcheck.internal.generator.CompositeGenerator.configure(CompositeGenerator.java:118)
at com.pholser.junit.quickcheck.internal.generator.GeneratorRepository.produceGenerator(GeneratorRepository.java:236)
at com.pholser.junit.quickcheck.internal.generator.GeneratorRepository.field(GeneratorRepository.java:173)
at com.pholser.junit.quickcheck.generator.Fields.generate(Fields.java:85)
at com.pholser.junit.quickcheck.internal.generator.CompositeGenerator.generate(CompositeGenerator.java:56)
at com.pholser.junit.quickcheck.internal.generator.PropertyParameterGenerationContext.generate(PropertyParameterGenerationContext.java:82)
at com.pholser.junit.quickcheck.internal.SeededValue.<init>(SeededValue.java:37)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at com.pholser.junit.quickcheck.internal.sampling.TupleParameterSampler.lambda$sample$0(TupleParameterSampler.java:67)
at java.base/java.util.stream.StreamSpliterators$InfiniteSupplyingSpliterator$OfRef.tryAdvance(StreamSpliterators.java:1360)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at com.pholser.junit.quickcheck.runner.PropertyStatement.evaluate(PropertyStatement.java:110)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)