当前位置: 首页>>代码示例>>Java>>正文


Java CtMethod.removeAnnotation方法代码示例

本文整理汇总了Java中spoon.reflect.declaration.CtMethod.removeAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java CtMethod.removeAnnotation方法的具体用法?Java CtMethod.removeAnnotation怎么用?Java CtMethod.removeAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spoon.reflect.declaration.CtMethod的用法示例。


在下文中一共展示了CtMethod.removeAnnotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cloneMethod

import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
protected CtMethod cloneMethod(CtMethod method, String suffix) {
    count++;
    CtMethod cloned_method = this.getFactory().Core().clone(method);
    cloned_method.setParent(method.getParent());
    //rename the clone
    cloned_method.setSimpleName(method.getSimpleName()+suffix+cloneNumber);
    cloneNumber++;

    CtAnnotation toRemove = cloned_method.getAnnotations().stream()
                                         .filter(annotation -> annotation.toString().contains("Override"))
                                         .findFirst().orElse(null);

    if(toRemove != null) {
        cloned_method.removeAnnotation(toRemove);
    }
    mutatedMethod.add(cloned_method);
    return cloned_method;
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:19,代码来源:TestProcessor.java

示例2: cloneMethod

import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
private CtMethod cloneMethod(CtMethod method) {
    CtMethod cloned_method = method.getFactory().Core().clone(method);

    CtAnnotation toRemove = cloned_method.getAnnotations().stream()
            .filter(annotation -> annotation.toString().contains("Override"))
            .findFirst().orElse(null);

    if(toRemove != null) {
        cloned_method.removeAnnotation(toRemove);
    }
    return cloned_method;
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:13,代码来源:ClassWithLoggerBuilder.java

示例3: cloneMethod

import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
private static CtMethod cloneMethod(CtMethod method, String suffix) {
    CtMethod cloned_method = method.clone();
    //rename the clone
    cloned_method.setSimpleName(method.getSimpleName() + (suffix.isEmpty() ? "" : suffix + cloneNumber));
    cloneNumber++;

    CtAnnotation toRemove = cloned_method.getAnnotations().stream()
            .filter(annotation -> annotation.toString().contains("Override"))
            .findFirst().orElse(null);

    if (toRemove != null) {
        cloned_method.removeAnnotation(toRemove);
    }
    return cloned_method;
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:16,代码来源:AmplificationHelper.java

示例4: cloneMethodTest

import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public static CtMethod cloneMethodTest(CtMethod method, String suffix) {
    CtMethod cloned_method = cloneMethod(method, suffix);
    CtAnnotation testAnnotation = cloned_method.getAnnotations().stream()
            .filter(annotation -> annotation.toString().contains("Test"))
            .findFirst().orElse(null);

    if (testAnnotation != null) {
        cloned_method.removeAnnotation(testAnnotation);
    }

    testAnnotation = method.getFactory().Core().createAnnotation();
    CtTypeReference<Object> ref = method.getFactory().Core().createTypeReference();
    ref.setSimpleName("Test");

    CtPackageReference refPackage = method.getFactory().Core().createPackageReference();
    refPackage.setSimpleName("org.junit");
    ref.setPackage(refPackage);
    testAnnotation.setAnnotationType(ref);

    Map<String, Object> elementValue = new HashMap<>();
    elementValue.put("timeout", timeOutInMs);
    testAnnotation.setElementValues(elementValue);

    cloned_method.addAnnotation(testAnnotation);

    return cloned_method;
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:28,代码来源:AmplificationHelper.java

示例5: cloneMethodTest

import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
protected CtMethod cloneMethodTest(CtMethod method, String suffix, int timeOut) {
    CtMethod cloned_method = cloneMethod(method,suffix);
    CtAnnotation testAnnotation = cloned_method.getAnnotations().stream()
            .filter(annotation -> annotation.toString().contains("Test"))
            .findFirst().orElse(null);

    if(testAnnotation != null) {
        cloned_method.removeAnnotation(testAnnotation);
    }

    testAnnotation = getFactory().Core().createAnnotation();
    CtTypeReference<Object> ref = getFactory().Core().createTypeReference();
    ref.setSimpleName("Test");

    CtPackageReference refPackage = getFactory().Core().createPackageReference();
    refPackage.setSimpleName("org.junit");
    ref.setPackage(refPackage);
    testAnnotation.setAnnotationType(ref);


    Map<String, Object> elementValue = new HashMap<String, Object>();
    elementValue.put("timeout", timeOut);
    testAnnotation.setElementValues(elementValue);

    cloned_method.addAnnotation(testAnnotation);

    ampclasses.add(cloned_method.getDeclaringType());
    return cloned_method;
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:30,代码来源:TestProcessor.java


注:本文中的spoon.reflect.declaration.CtMethod.removeAnnotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。