本文整理汇总了Java中spoon.reflect.code.CtReturn.getReturnedExpression方法的典型用法代码示例。如果您正苦于以下问题:Java CtReturn.getReturnedExpression方法的具体用法?Java CtReturn.getReturnedExpression怎么用?Java CtReturn.getReturnedExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spoon.reflect.code.CtReturn
的用法示例。
在下文中一共展示了CtReturn.getReturnedExpression方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isStopStatement
import spoon.reflect.code.CtReturn; //导入方法依赖的package包/类
private boolean isStopStatement(List<CtCodeElement> elements) {
// if (elements.size() == 1 && elements.toString().contains("return")){
// if (elements.get(0) instanceof CtReturn){
// CtReturn ret = (CtReturn) elements.get(0);
// if (ret.getReturnedExpression() == null){
// return true;
// }
// }
// }
if (elements.size() == 1) {
if (elements.toString().contains("return")) {
if (elements.get(0) instanceof CtReturn) {
CtReturn<?> ret = (CtReturn<?>) elements.get(0);
if (ret.getReturnedExpression() == null) {
return true;
}
}
} else if (elements.toString().contains("break")) { // ||
// elements.toString().contains("continue")){
return true;
}
}
return false;
}
示例2: isReturnInt
import spoon.reflect.code.CtReturn; //导入方法依赖的package包/类
protected boolean isReturnInt(CtElement stmt) {
if (stmt instanceof CtReturn) {
CtReturn ret = (CtReturn) stmt;
if(ret.getReturnedExpression() != null) {
try {
if (ret.getReturnedExpression().getType().getActualClass() == int.class) return true;
} catch (Exception e) {
}
}
}
return false;
}
示例3: isToBeProcessed
import spoon.reflect.code.CtReturn; //导入方法依赖的package包/类
public boolean isToBeProcessed(CtReturn candidate) {
try {
CtLiteral literal = (CtLiteral)candidate.getReturnedExpression();
String type = literal.getType().getSimpleName();
return type.equals("boolean") || type.equals("short") ||
type.equals("int") || type.equals("long") ||
type.equals("byte") || type.equals("float") ||
type.equals("double");
} catch (Exception e) {
return false;
}
}