@@ -11,16 +11,21 @@ import java.lang.reflect.Member
1111import java.lang.reflect.Method
1212import java.lang.reflect.Modifier
1313
14+ private fun isIgnored (type : ClassId ): Boolean {
15+ return type == stringClassId
16+ || type == dateClassId
17+ || type == NumberValueProvider .classId
18+ || type.isCollectionOrMap
19+ || type.isPrimitiveWrapper
20+ || type.isEnum
21+ || type.isAbstract
22+ || (type.isInner && ! type.isStatic)
23+ }
24+
1425class ObjectValueProvider (
1526 val idGenerator : IdGenerator <Int >,
1627) : ValueProvider<FuzzedType, FuzzedValue, FuzzedDescription> {
1728
18- private val unwantedConstructorsClasses = listOf (
19- stringClassId,
20- dateClassId,
21- NumberValueProvider .classId
22- )
23-
2429 override fun accept (type : FuzzedType ) = ! isIgnored(type.classId)
2530
2631 override fun generate (
@@ -88,15 +93,6 @@ class ObjectValueProvider(
8893 )
8994 }
9095
91- private fun isIgnored (type : ClassId ): Boolean {
92- return unwantedConstructorsClasses.contains(type)
93- || type.isCollectionOrMap
94- || type.isPrimitiveWrapper
95- || type.isEnum
96- || type.isAbstract
97- || (type.isInner && ! type.isStatic)
98- }
99-
10096 private fun findTypesOfNonRecursiveConstructor (type : FuzzedType , packageName : String? ): List <ConstructorId > {
10197 return type.classId.allConstructors
10298 .filter { isAccessible(it.constructor , packageName) }
@@ -137,7 +133,7 @@ class CreateObjectAnywayValueProvider(
137133 val useMock : Boolean = false ,
138134) : ValueProvider<FuzzedType, FuzzedValue, FuzzedDescription> {
139135
140- override fun accept (type : FuzzedType ) = type.classId.isRefType
136+ override fun accept (type : FuzzedType ) = type.classId.isRefType && ! isIgnored(type.classId)
141137
142138 override fun generate (description : FuzzedDescription , type : FuzzedType ) = sequence<Seed <FuzzedType , FuzzedValue >> {
143139 val methodCalls = description.constants.filter {
0 commit comments