@@ -11,16 +11,21 @@ import java.lang.reflect.Member
11
11
import java.lang.reflect.Method
12
12
import java.lang.reflect.Modifier
13
13
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
+
14
25
class ObjectValueProvider (
15
26
val idGenerator : IdGenerator <Int >,
16
27
) : ValueProvider<FuzzedType, FuzzedValue, FuzzedDescription> {
17
28
18
- private val unwantedConstructorsClasses = listOf (
19
- stringClassId,
20
- dateClassId,
21
- NumberValueProvider .classId
22
- )
23
-
24
29
override fun accept (type : FuzzedType ) = ! isIgnored(type.classId)
25
30
26
31
override fun generate (
@@ -88,15 +93,6 @@ class ObjectValueProvider(
88
93
)
89
94
}
90
95
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
-
100
96
private fun findTypesOfNonRecursiveConstructor (type : FuzzedType , packageName : String? ): List <ConstructorId > {
101
97
return type.classId.allConstructors
102
98
.filter { isAccessible(it.constructor , packageName) }
@@ -137,7 +133,7 @@ class CreateObjectAnywayValueProvider(
137
133
val useMock : Boolean = false ,
138
134
) : ValueProvider<FuzzedType, FuzzedValue, FuzzedDescription> {
139
135
140
- override fun accept (type : FuzzedType ) = type.classId.isRefType
136
+ override fun accept (type : FuzzedType ) = type.classId.isRefType && ! isIgnored(type.classId)
141
137
142
138
override fun generate (description : FuzzedDescription , type : FuzzedType ) = sequence<Seed <FuzzedType , FuzzedValue >> {
143
139
val methodCalls = description.constants.filter {
0 commit comments