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


Java VisibilityAnnotationTag.getAnnotations方法代码示例

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


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

示例1: extractJUnitTestsHelper

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
protected List<SootMethod> extractJUnitTestsHelper(SootClass cl) {
    //System.out.println("prepare cl " + cl + ", tag_sz=" + cl.getTags().size() + ", cl.tags" + cl.getTags());

    ArrayList<SootMethod> testMethods = new ArrayList<SootMethod>();

    Iterator<SootMethod> it = cl.methodIterator();
    while (it.hasNext()) {
        SootMethod m = it.next();
        //System.out.println("method:" + m + ", isPublic:" + m.isPublic() +", isNative:" + m.isNative() + ", tags: " + m.getTags());
        boolean found = false;
        for(soot.tagkit.Tag tg : m.getTags()) {
            if(!found && tg instanceof soot.tagkit.VisibilityAnnotationTag) {
                VisibilityAnnotationTag vat = (VisibilityAnnotationTag) tg;
                for( AnnotationTag at : vat.getAnnotations()) {
                    //System.out.println("type: " + at.getType());
                    if(at.getType().equals("Lorg/junit/Test;")) {
                        found = true;
                        break;
                    }
                }
            }
        }
        if(found) testMethods.add(m);
    }
    return testMethods;
}
 
开发者ID:petablox-project,项目名称:petablox,代码行数:27,代码来源:RTA.java

示例2: parseVisibilityAnnotationTag

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
public static Map<String,List<Pair<String,String>>> parseVisibilityAnnotationTag(VisibilityAnnotationTag v){
    Map<String,List<Pair<String,String>>> result = new HashMap<String,List<Pair<String,String>>>();
    List<AnnotationTag> aTags = v.getAnnotations();
    for(AnnotationTag a : aTags){
        String annotationName = a.getType();
        List<Pair<String,String>> elems = null;
        if(!result.containsKey(annotationName)){
            elems = new ArrayList<Pair<String,String>>();
            result.put(annotationName, elems);
        }else
            elems = result.get(annotationName);
        for(AnnotationElem ae : a.getElems()){
            if(ae.getKind() == 's'){
                AnnotationStringElem ase = (AnnotationStringElem)ae;
                Pair<String,String> keyValue = new Pair<String,String>(ase.getName(),ase.getValue());
                elems.add(keyValue);
            }
        }
    }
    return result;
}
 
开发者ID:petablox-project,项目名称:petablox,代码行数:22,代码来源:SootUtilities.java

示例3: isAtomicAnnotated

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
public static boolean isAtomicAnnotated(SootMethod method)
{
    Tag tag=method.getTag("VisibilityAnnotationTag");

    if (tag == null)
        return false;

    VisibilityAnnotationTag visibilityAnnotationTag=(VisibilityAnnotationTag)tag;
    List<AnnotationTag> annotations=visibilityAnnotationTag.getAnnotations();

    for (AnnotationTag annotationTag: annotations)
        if (annotationTag.getType().endsWith("/"+ATOMIC_METHOD_ANNOTATION+";"))
            return true;

    return false;
}
 
开发者ID:trxsys,项目名称:gluon,代码行数:17,代码来源:AtomicityAnalysis.java

示例4: extractContractRaw

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
private String extractContractRaw()
{
     Tag tag=module.getTag("VisibilityAnnotationTag");

     if (tag == null)
        return null;

    VisibilityAnnotationTag visibilityAnnotationTag=(VisibilityAnnotationTag) tag;
    List<AnnotationTag> annotations=visibilityAnnotationTag.getAnnotations();

    for (AnnotationTag annotationTag: annotations)
        if (annotationTag.getType().endsWith("/"+CONTRACT_ANNOTATION+";")
            && annotationTag.getNumElems() == 1
            && annotationTag.getElemAt(0) instanceof AnnotationStringElem
            && annotationTag.getElemAt(0).getName().equals("clauses"))
        {
            AnnotationStringElem e=(AnnotationStringElem)annotationTag.getElemAt(0);

            return e.getValue();
        }

    return null;
}
 
开发者ID:trxsys,项目名称:gluon,代码行数:24,代码来源:Contract.java

示例5: for

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
private List<ImmutableAnnotation> buildVisibilityAnnotationTag
		(VisibilityAnnotationTag t, Set<String> skipList) {
   	if (t.getAnnotations() == null)
   		return Collections.emptyList();
   	
   	List<ImmutableAnnotation> annotations = new ArrayList<ImmutableAnnotation>();
       for (AnnotationTag at: t.getAnnotations()) {
           String type = at.getType();
           if (!skipList.add(type))
           	continue;
           
           Set<String> alreadyWritten = new HashSet<String>();
           List<AnnotationElement> elements = null;
           if (!at.getElems().isEmpty()) {
           	elements = new ArrayList<AnnotationElement>();
            for (AnnotationElem ae : at.getElems()) {
            	if (ae.getName() == null || ae.getName().isEmpty())
            		throw new RuntimeException("Null or empty annotation name encountered");
            	if (!alreadyWritten.add(ae.getName()))
            		throw new RuntimeException("Duplicate annotation attribute: " + ae.getName());
            	
                EncodedValue value = buildEncodedValueForAnnotation(ae);
                ImmutableAnnotationElement element = new ImmutableAnnotationElement
                		(ae.getName(), value);
                elements.add(element);
            }
           }
           
           String typeName = SootToDexUtils.getDexClassName(at.getType());
           ImmutableAnnotation ann = new ImmutableAnnotation(getVisibility(t.getVisibility()),
           		typeName, elements);
           annotations.add(ann);
       }
       return annotations;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:36,代码来源:DexPrinter.java

示例6: parseAnnotations

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
public static LinkedList<SootAnnotations.Annotation> parseAnnotations(VisibilityAnnotationTag vtag) {
	LinkedList<SootAnnotations.Annotation> annot = new LinkedList<SootAnnotations.Annotation>();
	if (vtag == null || vtag.getAnnotations()==null) {
		//no annotation
		return annot;
	}
	for (AnnotationTag at : vtag.getAnnotations()) {
		addTagToList(annot, at);
	}
	return annot;
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:12,代码来源:SootAnnotations.java

示例7: if

import soot.tagkit.VisibilityAnnotationTag; //导入方法依赖的package包/类
private List<ImmutableAnnotation> buildVisibilityParameterAnnotationTag
  		(VisibilityParameterAnnotationTag t, Set<String> skipList,
  				int paramIdx) {
if (t.getVisibilityAnnotations() == null)
  		return Collections.emptyList();

      int paramTagIdx = 0;
  	List<ImmutableAnnotation> annotations = new ArrayList<ImmutableAnnotation>();
      for (VisibilityAnnotationTag vat : t.getVisibilityAnnotations()) {
      	if (paramTagIdx == paramIdx
      			&& vat != null
      			&& vat.getAnnotations() != null)
       	for (AnnotationTag at : vat.getAnnotations()) {
            String type = at.getType();
            if (!skipList.add(type))
            	continue;
            
            Set<String> alreadyWritten = new HashSet<String>();
            List<AnnotationElement> elements = null;
            if (!at.getElems().isEmpty()) {
            	elements = new ArrayList<AnnotationElement>();
	            for (AnnotationElem ae : at.getElems()) {
	            	if (ae.getName() == null || ae.getName().isEmpty())
	            		throw new RuntimeException("Null or empty annotation name encountered");
	            	if (!alreadyWritten.add(ae.getName()))
	            		throw new RuntimeException("Duplicate annotation attribute: " + ae.getName());
	
	            	EncodedValue value = buildEncodedValueForAnnotation(ae);
	                ImmutableAnnotationElement element = new ImmutableAnnotationElement(ae.getName(), value);
	                elements.add(element);
	            }
            }
            
            ImmutableAnnotation ann = new ImmutableAnnotation(getVisibility(vat.getVisibility()),
            		SootToDexUtils.getDexClassName(at.getType()),
            		elements);
            annotations.add(ann);
       	}
      	paramTagIdx++;
      }
      return annotations;
  }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:43,代码来源:DexPrinter.java


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