Skip to content

Commit ee386a3

Browse files
committed
Fix CI
1 parent 1b24287 commit ee386a3

File tree

16 files changed

+19
-23
lines changed

16 files changed

+19
-23
lines changed

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rootProject.name = "utbot"
2828
include("utbot-core")
2929
include("utbot-framework")
3030
include("utbot-framework-api")
31-
include("utbot-modification-analyzer")
31+
include("utbot-modificators-analyzer")
3232
include("utbot-intellij")
3333
include("utbot-sample")
3434
include("utbot-java-fuzzing")

utbot-framework/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
api project(':utbot-summary')
1515
api project(':utbot-framework-api')
1616
api project(':utbot-rd')
17-
api project(':utbot-modification-analyzer')
17+
api project(':utbot-modificators-analyzer')
1818

1919
implementation group: 'com.jetbrains.rd', name: 'rd-framework', version: rdVersion
2020
implementation group: 'com.jetbrains.rd', name: 'rd-core', version: rdVersion

utbot-framework/src/main/kotlin/org/utbot/framework/util/EngineUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger
1414

1515
private val logger = KotlinLogging.logger { }
1616

17-
private val instanceCounter = AtomicInteger(0)
17+
val instanceCounter = AtomicInteger(0)
1818

1919
fun nextModelName(base: String): String = "$base${instanceCounter.incrementAndGet()}"
2020

utbot-java-fuzzing/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ val rgxgenVersion: String by rootProject
55
dependencies {
66
implementation(project(":utbot-framework-api"))
77
api(project(":utbot-fuzzing"))
8-
api(project(":utbot-modification-analyzer"))
8+
api(project(":utbot-modificators-analyzer"))
99

1010
implementation("org.unittestbot.soot:soot-utbot-fork:${sootVersion}") {
1111
exclude(group="com.google.guava", module="guava")

utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class ObjectValueProvider(
104104
}
105105
}
106106
}
107-
if (true || shouldMutateWithMethods) {
107+
if (shouldMutateWithMethods) {
108108
findAllAvailableMethods(description, classId, description.description.packageName).forEach { md ->
109109
yield(Routine.Call(md.parameterTypes) { self, values ->
110110
val model = self.model as UtAssembleModel
@@ -263,9 +263,6 @@ internal fun findAccessibleModifiableFields(description: FuzzedDescription?, cla
263263
}.toList()
264264
}
265265

266-
/**
267-
* text.
268-
*/
269266
internal fun findAllAvailableMethods(
270267
description: FuzzedDescription?,
271268
classId: ClassId,
@@ -334,7 +331,7 @@ private fun findModifyingMethodNames(classId: ClassId) =
334331
UtBotFieldsModificatorsSearcher()
335332
.let { searcher ->
336333
searcher.update(setOf(classId))
337-
searcher.getModificatorToFields(AnalysisMode.AllModificators)
334+
searcher.getModificatorToFields(AnalysisMode.Methods)
338335
.keys
339336
.mapTo(mutableSetOf()) { it.name }
340337
}

utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/SpringBeanValueProvider.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,7 @@ class SpringBeanValueProvider(
8080
}
8181
})
8282
}
83-
/**
84-
* We find all methods that are public, accessible, are not setters and modify at least one field.
85-
* We don't take setters because they may
86-
*/
8783
findAllAvailableMethods(description, type.classId, description.description.packageName)
88-
.removeSetters()
8984
.forEach { md ->
9085
yield(Routine.Call(md.parameterTypes) { self, values ->
9186
val model = self.model as UtAssembleModel
@@ -103,9 +98,4 @@ class SpringBeanValueProvider(
10398
)
10499
}
105100
}
106-
107-
private fun List<MethodDescription>.removeSetters(): List<MethodDescription> =
108-
filterNot { md ->
109-
md.method.name.startsWith("set") && md.method.parameterCount == 1
110-
}
111101
}

utbot-modification-analyzer/src/main/kotlin/org/utbot/modifications/AnalysisMode.kt renamed to utbot-modificators-analyzer/src/main/kotlin/org/utbot/modifications/AnalysisMode.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.utbot.modifications
22

33
/**
4-
* Restrictions on demanded modificators
4+
* Restrictions on demanded modifications
55
*/
66
enum class AnalysisMode {
77

@@ -20,5 +20,9 @@ enum class AnalysisMode {
2020
*/
2121
Constructors,
2222

23-
// TODO?: add all modificators without constructors (methods only)
23+
/**
24+
* Look for methods that modify fields.
25+
* Setters are excluded.
26+
*/
27+
Methods,
2428
}

utbot-modification-analyzer/src/main/kotlin/org/utbot/modifications/StatementsStorage.kt renamed to utbot-modificators-analyzer/src/main/kotlin/org/utbot/modifications/StatementsStorage.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package org.utbot.modifications
22

33
import org.utbot.modifications.AnalysisMode.AllModificators
4+
import org.utbot.modifications.AnalysisMode.Methods
45
import org.utbot.modifications.AnalysisMode.Constructors
56
import org.utbot.modifications.AnalysisMode.SettersAndDirectAccessors
67
import org.utbot.framework.plugin.api.ClassId
78
import org.utbot.framework.plugin.api.ConstructorId
89
import org.utbot.framework.plugin.api.DirectFieldAccessId
910
import org.utbot.framework.plugin.api.ExecutableId
1011
import org.utbot.framework.plugin.api.FieldId
12+
import org.utbot.framework.plugin.api.MethodId
1113
import org.utbot.framework.plugin.api.StatementId
1214

1315
/**
@@ -91,12 +93,15 @@ class StatementsStorage {
9193
statementId: StatementId,
9294
analysisMode: AnalysisMode,
9395
): Set<FieldId> {
96+
fun isSetterOrDirectAccessor(statementId: StatementId, fields: Set<FieldId>): Boolean =
97+
isSetterOrDirectAccessor(statementId) && fields.size == 1
98+
9499
val fields = items[statementId]?.allModifiedFields ?: return emptySet()
95100

96101
return when (analysisMode) {
97102
AllModificators -> fields
98-
SettersAndDirectAccessors -> if (isSetterOrDirectAccessor(statementId) && fields.size == 1) fields else emptySet()
99-
// TODO: add Methods -> { ... }
103+
Methods -> if (statementId is MethodId && !isSetterOrDirectAccessor(statementId, fields)) fields else emptySet()
104+
SettersAndDirectAccessors -> if (isSetterOrDirectAccessor(statementId, fields)) fields else emptySet()
100105
Constructors -> if (statementId is ConstructorId) fields else emptySet()
101106
}
102107
}

0 commit comments

Comments
 (0)