spoon.reflect.code.CtAssert Java Examples

The following examples show how to use spoon.reflect.code.CtAssert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransformStrategy.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <T> void visitCtAssert(CtAssert<T> asserted) {
	super.visitCtAssert(asserted);

	CtExpression exper=asserted.getExpression();
	if (candidates.containsKey(exper)) {
		asserted.setExpression(candidates.get(exper));
		saveSketchAndSynthesize();
		asserted.setExpression(exper);
		resoreDiskFile();
	}
	
	CtExpression assertexper=asserted.getAssertExpression();
	if (candidates.containsKey(assertexper)) {
		asserted.setAssertExpression(candidates.get(assertexper));
		saveSketchAndSynthesize();
		asserted.setAssertExpression(assertexper);
		resoreDiskFile();
	}
}
 
Example #2
Source File: TransformStrategy.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<String> transform () {
	CtStatement targetStmt = (CtStatement) this.modificationPoint.getCodeElement();
	if (targetStmt instanceof CtInvocation)
		this.visitCtInvocation((CtInvocation) targetStmt);
	else if (targetStmt instanceof CtConstructorCall)
		this.visitCtConstructorCall((CtConstructorCall) targetStmt);
	else if (targetStmt instanceof CtIf)
		this.visitCtIf ((CtIf)targetStmt);
	else if (targetStmt instanceof CtReturn)
		this.visitCtReturn((CtReturn) targetStmt);
	else if (targetStmt instanceof CtSwitch)
		this.visitCtSwitch((CtSwitch) targetStmt);
	else if (targetStmt instanceof CtCase)
		this.visitCtCase((CtCase) targetStmt);
	else if (targetStmt instanceof CtAssignment)
		this.visitCtAssignment((CtAssignment) targetStmt);
	else if (targetStmt instanceof CtAssert)
		this.visitCtAssert((CtAssert) targetStmt);
	else if (targetStmt instanceof CtFor)
		this.visitCtFor((CtFor) targetStmt);
	else if (targetStmt instanceof CtForEach)
		this.visitCtForEach((CtForEach) targetStmt);
	else if (targetStmt instanceof CtWhile)
		this.visitCtWhile((CtWhile) targetStmt);
	else if (targetStmt instanceof CtUnaryOperator)
		this.visitCtUnaryOperator((CtUnaryOperator) targetStmt);
	else if (targetStmt instanceof CtSynchronized)
		this.visitCtSynchronized((CtSynchronized) targetStmt);

	return list;
}
 
Example #3
Source File: LabelFinder.java    From gumtree-spoon-ast-diff with Apache License 2.0 4 votes vote down vote up
@Override
public <T> void visitCtAssert(CtAssert<T> e) {
	label = "assert";
}