Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static Object getValue(Object document, String fieldName) {
}
}

@SuppressWarnings("unchecked")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't add @SuppressWarnings. as a rule of thumb, adding annotations just to remove warning messages from build is not something i like

public static Set<String> keySet(Object document) {
try {
return (Set<String>) document.getClass().getMethod("keySet").invoke(document);
Expand All @@ -47,6 +48,7 @@ public static Boolean documentContainsField(Object document, String field) {
}
}

@SuppressWarnings("unchecked")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment

public static Set<String> documentKeys(Object document) {
try {
return (Set<String>) document.getClass().getMethod("keySet").invoke(document);
Expand All @@ -67,7 +69,7 @@ public static String getType(Object bsonType) {
Object bsonTypeClassMap = bsonTypeClassMapClass.getDeclaredConstructor().newInstance();
Method get = bsonTypeClassMapClass.getMethod("get", bsonTypeClass);
Object type = get.invoke(bsonTypeClassMap, bsonType);
return (String) type.getClass().getMethod("getTypeName").invoke(type, null);
return (String) type.getClass().getMethod("getTypeName").invoke(type);
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException |
InvocationTargetException e) {
throw new RuntimeException(e);
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/kotlin/org/evomaster/core/BaseModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.evomaster.core
import com.google.inject.AbstractModule
import com.google.inject.Provides
import com.google.inject.Singleton
import org.evomaster.core.output.service.PartialOracles
import org.evomaster.core.search.service.mutator.genemutation.ArchiveImpactSelector
import org.evomaster.core.search.service.*
import org.evomaster.core.search.service.monitor.SearchProcessMonitor
Expand Down Expand Up @@ -80,9 +79,6 @@ class BaseModule(val args: Array<String>, val noTests: Boolean = false) : Abstra
bind(MutationWeightControl::class.java)
.asEagerSingleton()

bind(PartialOracles::class.java)
.asEagerSingleton()

bind(ExecutionInfoReporter::class.java)
.asEagerSingleton()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.evomaster.core.output

import org.evomaster.core.EMConfig
import org.evomaster.core.output.clustering.SplitResult
import org.evomaster.core.output.service.PartialOracles
import org.evomaster.core.problem.graphql.GraphQlCallResult
import org.evomaster.core.problem.httpws.HttpWsCallResult
import org.evomaster.core.problem.rpc.RPCCallResult
Expand Down Expand Up @@ -111,12 +110,12 @@ object TestSuiteSplitter {
return splitResult
}

private fun <T : Individual> faultIndividuals(sol: Solution<T>, oracles: PartialOracles, config: EMConfig) =
private fun <T : Individual> faultIndividuals(sol: Solution<T>, config: EMConfig) =
sol.individuals.filter { ind ->
ind.hasAnyPotentialFault()
}.toMutableList()

private fun <T : Individual> successIndividuals(solution: Solution<T>, oracles: PartialOracles, config: EMConfig) =
private fun <T : Individual> successIndividuals(solution: Solution<T>, config: EMConfig) =
solution.individuals.filter { ind ->
!ind.hasAnyPotentialFault()
&&
Expand Down Expand Up @@ -258,9 +257,9 @@ object TestSuiteSplitter {
* if any further action or investigation is required.
*/
private fun <T : Individual> splitByFault(solution: Solution<T>, config: EMConfig): List<Solution<T>> {
val faults = faultIndividuals(solution, PartialOracles(), config)
val faults = faultIndividuals(solution, config)

val successes = successIndividuals(solution, PartialOracles(), config)
val successes = successIndividuals(solution, config)

val remainder = solution.individuals.filter {
!faults.contains(it) && !successes.contains(it)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class RestTestCaseWriter : HttpWsTestCaseWriter {
private val log = LoggerFactory.getLogger(RestTestCaseWriter::class.java)
}

@Inject
private lateinit var partialOracles: PartialOracles

@Inject
private lateinit var callGraphService: CallGraphService

Expand All @@ -47,9 +44,8 @@ class RestTestCaseWriter : HttpWsTestCaseWriter {
/**
* ONLY for tests
*/
constructor(config: EMConfig, partialOracles: PartialOracles) : super() {
constructor(config: EMConfig) : super() {
this.config = config
this.partialOracles = partialOracles
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ class TestSuiteWriter {
@Inject
private lateinit var testCaseWriter: TestCaseWriter

@Inject
private lateinit var partialOracles: PartialOracles

@Inject(optional = true)
private lateinit var sampler: Sampler<*>

Expand Down Expand Up @@ -1148,16 +1145,6 @@ class TestSuiteWriter {
lines.addStatement(statement)
}


/**
* FIXME replace with direct injection
*/
@Deprecated("replace with direct injection")
fun getPartialOracles(): PartialOracles {
return partialOracles
}


private fun useRestAssured() = config.problemType == EMConfig.ProblemType.REST || config.problemType == EMConfig.ProblemType.GRAPHQL

//TODO better check. need to review use in RPC and GraphQL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.evomaster.core.parser

import org.evomaster.core.search.gene.Gene
import org.evomaster.core.search.gene.regex.*
import org.evomaster.core.utils.CharacterRange

Expand All @@ -10,7 +9,7 @@ import org.evomaster.core.utils.CharacterRange
class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>() {

/*
WARNING: lot of code here is similar/adapted from ECMA262 visitor.
WARNING: lots of code here is similar/adapted from the ECMA262 visitor.
But, as the parser objects are different, it does not seem simple to reuse
the code without avoiding copy&paste&adapt :(
*/
Expand All @@ -36,7 +35,7 @@ class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>()

val altRes = ctx.alternative().accept(this)

val disj = DisjunctionRxGene("disj", altRes.genes.map { it as Gene }, true, true)
val disj = DisjunctionRxGene("disj", altRes.genes.map { it }, true, true)

val res = VisitResult(disj)

Expand Down Expand Up @@ -182,7 +181,7 @@ class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>()

val negated = ctx.CARET() != null

val ranges = ctx.classRanges().accept(this).data as List<CharacterRange>
val ranges = ctx.classRanges().accept(this).requireDataList<CharacterRange>()

val gene = CharacterRangeRxGene(negated, ranges)

Expand All @@ -195,7 +194,7 @@ class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>()
val list = mutableListOf<CharacterRange>()

if(ctx.nonemptyClassRanges() != null){
val ranges = ctx.nonemptyClassRanges().accept(this).data as List<CharacterRange>
val ranges = ctx.nonemptyClassRanges().accept(this).requireDataList<CharacterRange>()
list.addAll(ranges)
}

Expand All @@ -222,12 +221,12 @@ class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>()
list.add(CharacterRange(start, end))

if(ctx.nonemptyClassRangesNoDash() != null){
val ranges = ctx.nonemptyClassRangesNoDash().accept(this).data as List<CharacterRange>
val ranges = ctx.nonemptyClassRangesNoDash().accept(this).requireDataList<CharacterRange>()
list.addAll(ranges)
}

if(ctx.classRanges() != null){
val ranges = ctx.classRanges().accept(this).data as List<CharacterRange>
val ranges = ctx.classRanges().accept(this).requireDataList<CharacterRange>()
list.addAll(ranges)
}

Expand Down Expand Up @@ -255,12 +254,12 @@ class GenePostgresSimilarToVisitor : PostgresSimilarToBaseVisitor<VisitResult>()
}

if(ctx.nonemptyClassRangesNoDash() != null){
val ranges = ctx.nonemptyClassRangesNoDash().accept(this).data as List<CharacterRange>
val ranges = ctx.nonemptyClassRangesNoDash().accept(this).requireDataList<CharacterRange>()
list.addAll(ranges)
}

if(ctx.classRanges() != null){
val ranges = ctx.classRanges().accept(this).data as List<CharacterRange>
val ranges = ctx.classRanges().accept(this).requireDataList<CharacterRange>()
list.addAll(ranges)
}

Expand Down
Loading