/** {@inheritDoc} */ @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (name.equals("<clinit>")) return mv; if (!DependencyAnalysis.shouldInstrument(ResourceList.getClassNameFromResourcePath(className), name + desc)) return mv; logger.info("Applying error transformation to " + className + ", method " + name + desc); return new ErrorConditionMethodAdapter(mv, className, name, access, desc); } }
/** {@inheritDoc} */ @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (name.equals("<clinit>")) return mv; if (name.equals(ClassResetter.STATIC_RESET)) return mv; if (!DependencyAnalysis.shouldInstrument(ResourceList.getClassNameFromResourcePath(className), name + desc)) return mv; logger.info("Applying exception transformation to " + className + ", method " + name + desc); return new ExceptionTransformationMethodAdapter(mv, className, name, access, desc); } }
/** * <p> * registerActualCFG * </p> * * @param cfg * a {@link org.evosuite.graphs.cfg.ActualControlFlowGraph} * object. */ public void registerActualCFG(ActualControlFlowGraph cfg) { String className = cfg.getClassName(); String methodName = cfg.getMethodName(); if (className == null || methodName == null) throw new IllegalStateException( "expect class and method name of CFGs to be set before entering the GraphPool"); if (!actualCFGs.containsKey(className)) { actualCFGs.put(className, new HashMap<String, ActualControlFlowGraph>()); // diameters.put(className, new HashMap<String, Double>()); } Map<String, ActualControlFlowGraph> methods = actualCFGs.get(className); logger.debug("Added CFG for class " + className + " and method " + methodName); cfg.finalise(); methods.put(methodName, cfg); if (Properties.WRITE_CFG) cfg.toDot(); if (DependencyAnalysis.shouldInstrument(cfg.getClassName(), cfg.getMethodName())) { createAndRegisterControlDependence(cfg); } }
return mv; if (!DependencyAnalysis.shouldInstrument(className, name + descriptor)) return mv;
/** * Called by the BytecodeInstructionPool whenever it detects an instruction * that corresponds to a Branch in the class under test as defined by * BytecodeInstruction.isActualBranch(). * * @param instruction * a {@link org.evosuite.graphs.cfg.BytecodeInstruction} object. */ public void registerAsBranch(BytecodeInstruction instruction) { if (!(instruction.isActualBranch())) throw new IllegalArgumentException("CFGVertex of a branch expected"); if (isKnownAsBranch(instruction)) return; if (!DependencyAnalysis.shouldInstrument(instruction.getClassName(), instruction.getMethodName())) { return; } registerInstruction(instruction); }
if (DependencyAnalysis.shouldInstrument(className, methodName)) { if (ArrayUtil.contains(Properties.CRITERION, Criterion.DEFUSE) || ArrayUtil.contains(Properties.CRITERION, Criterion.ALLDEFS)) { logger.info("Created CFG for method " + methodName); if (DependencyAnalysis.shouldInstrument(className, methodName)) { if (!methods.get(classLoader).containsKey(className)) methods.get(classLoader).put(className, new HashSet<String>());