本文整理汇总了Java中spoon.reflect.declaration.CtMethod.getDeclaringType方法的典型用法代码示例。如果您正苦于以下问题:Java CtMethod.getDeclaringType方法的具体用法?Java CtMethod.getDeclaringType怎么用?Java CtMethod.getDeclaringType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spoon.reflect.declaration.CtMethod
的用法示例。
在下文中一共展示了CtMethod.getDeclaringType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public List<CtMethod> apply(CtMethod method) {
List<CtMethod> methods = new ArrayList<>();
if (method.getDeclaringType() != null) {
//get the list of method calls
List<CtInvocation> invocations = Query.getElements(method, new TypeFilter(CtInvocation.class));
//this index serves to replace ith literal is replaced by zero in the ith clone of the method
int invocation_index = 0;
for (CtInvocation invocation : invocations) {
try {
if (toRemove(invocation)
&& !AmplificationChecker.isAssert(invocation)
&& !inWhileLoop(invocation)
&& !containsIteratorNext(invocation)) {
methods.add(apply(method, invocation_index));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
invocation_index++;
}
}
return AmplificationHelper.updateAmpTestToParent(methods, method);
}
示例2: apply
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public List<CtMethod> apply(CtMethod method) {
List<CtMethod> methods = new ArrayList<>();
if (method.getDeclaringType() != null) {
//get the list of method calls
List<CtInvocation> invocations = Query.getElements(method, new TypeFilter(CtInvocation.class));
//this index serves to replace ith literal is replaced by zero in the ith clone of the method
int invocation_index = 0;
for (CtInvocation invocation : invocations) {
try {
if (AmplificationChecker.canBeAdded(invocation) && !AmplificationChecker.isAssert(invocation)) {
methods.add(apply(method, invocation_index));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
invocation_index++;
}
}
return AmplificationHelper.updateAmpTestToParent(methods, method);
}
示例3: applyRandom
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public CtMethod applyRandom(CtMethod method) {
if (method.getDeclaringType() != null) {
List<CtInvocation> invocations = Query.getElements(method, new TypeFilter(CtInvocation.class));
if (!invocations.isEmpty()) {
try {
int invocation_index = AmplificationHelper.getRandom().nextInt(invocations.size());
return apply(method, invocation_index);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return null;
}
示例4: applyRandom
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public CtMethod applyRandom(CtMethod method) {
if (method.getDeclaringType() != null) {
List<CtInvocation> invocations = Query.getElements(method, new TypeFilter(CtInvocation.class));
while (!invocations.isEmpty()) {
try {
int invocation_index = AmplificationHelper.getRandom().nextInt(invocations.size());
return apply(method, invocation_index);
} catch (Exception ignored) {
}
}
}
return null;
}