use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestClusterGenerator method addDependencies.
private void addDependencies(GenericConstructor constructor, int recursionLevel) {
if (recursionLevel > Properties.CLUSTER_RECURSION) {
logger.debug("Maximum recursion level reached, not adding dependencies of {}", constructor);
return;
}
if (dependencyCache.contains(constructor)) {
return;
}
logger.debug("Analyzing dependencies of " + constructor);
dependencyCache.add(constructor);
for (java.lang.reflect.Type parameterClass : constructor.getRawParameterTypes()) {
logger.debug("Adding dependency " + parameterClass);
addDependency(new GenericClass(parameterClass), recursionLevel);
}
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestClusterGenerator method getAssignableTypes.
// private Set<Class<?>> getConcreteClassesEnum() {
// Set<Class<?>> enumClasses = new LinkedHashSet<Class<?>>();
// for (String className : inheritanceTree.getSubclasses("java.lang.Enum"))
// {
// logger.warn("Enum candidate: " + className);
// }
//
// return enumClasses;
// }
private List<List<GenericClass>> getAssignableTypes(GenericClass clazz) {
List<List<GenericClass>> tuples = new ArrayList<>();
// logger.info("Parameters of " + clazz.getSimpleName() + ": "
// + clazz.getNumParameters());
boolean first = true;
for (java.lang.reflect.Type parameterType : clazz.getParameterTypes()) {
// logger.info("Current parameter: " + parameterType);
List<GenericClass> assignableClasses = getAssignableTypes(parameterType);
List<List<GenericClass>> newTuples = new ArrayList<>();
for (GenericClass concreteClass : assignableClasses) {
if (first) {
List<GenericClass> tuple = new ArrayList<>();
tuple.add(concreteClass);
newTuples.add(tuple);
} else {
for (List<GenericClass> t : tuples) {
List<GenericClass> tuple = new ArrayList<>(t);
tuple.add(concreteClass);
newTuples.add(tuple);
}
}
}
tuples = newTuples;
first = false;
}
return tuples;
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestClusterGenerator method getAssignableTypes.
private List<GenericClass> getAssignableTypes(java.lang.reflect.Type type) {
List<GenericClass> types = new ArrayList<>();
for (GenericClass clazz : genericCastClasses) {
if (clazz.isAssignableTo(type)) {
logger.debug(clazz + " is assignable to " + type);
types.add(clazz);
}
}
return types;
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestClusterGenerator method addDependencies.
private void addDependencies(GenericField field, int recursionLevel) {
if (recursionLevel > Properties.CLUSTER_RECURSION) {
logger.debug("Maximum recursion level reached, not adding dependencies of {}", field);
return;
}
if (dependencyCache.contains(field)) {
return;
}
if (field.getField().getType().isPrimitive() || field.getField().getType().equals(String.class))
return;
logger.debug("Analyzing dependencies of " + field);
dependencyCache.add(field);
logger.debug("Adding dependency " + field.getName());
addDependency(new GenericClass(field.getGenericFieldType()), recursionLevel);
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class CastClassManager method addCastClass.
public void addCastClass(Type type, int depth) {
GenericClass castClazz = new GenericClass(type);
addCastClass(castClazz.getWithWildcardTypes(), depth);
}
Aggregations