本文整理汇总了Java中soot.tagkit.VisibilityAnnotationTag类的典型用法代码示例。如果您正苦于以下问题:Java VisibilityAnnotationTag类的具体用法?Java VisibilityAnnotationTag怎么用?Java VisibilityAnnotationTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisibilityAnnotationTag类属于soot.tagkit包,在下文中一共展示了VisibilityAnnotationTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVisibilityParameterAnnotationAttr
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
private String getVisibilityParameterAnnotationAttr(VisibilityParameterAnnotationTag tag){
StringBuffer sb = new StringBuffer();
sb.append(".param ");
if (tag.getKind() == AnnotationConstants.RUNTIME_VISIBLE){
sb.append(".runtime_visible_annotation\n");
}
else {
sb.append(".runtime_invisible_annotation\n");
}
ArrayList<VisibilityAnnotationTag> vis_list = tag.getVisibilityAnnotations();
if (vis_list != null){
for (VisibilityAnnotationTag vat : vis_list) {
VisibilityAnnotationTag safeVat = vat == null
? getSafeVisibilityAnnotationTag(tag.getKind()) : vat;
sb.append(getVisibilityAnnotationAttr(safeVat));
}
}
sb.append(".end .param\n");
return sb.toString();
}
示例2: visitAnnotation
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
/**
* @see FieldVisitor#visitAnnotation(String, boolean)
* @see MethodVisitor#visitAnnotation(String, boolean)
* @see ClassVisitor#visitAnnotation(String, boolean)
*/
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
VisibilityAnnotationTag tag;
if (visible) {
tag = visibleTag;
if (tag == null) {
visibleTag = tag = new VisibilityAnnotationTag(AnnotationConstants.RUNTIME_VISIBLE);
host.addTag(tag);
}
} else {
tag = invisibleTag;
if (tag == null) {
invisibleTag = tag = new VisibilityAnnotationTag(AnnotationConstants.RUNTIME_INVISIBLE);
host.addTag(tag);
}
}
scb.addDep(AsmUtil.toQualifiedName(desc.substring(1, desc.length() - 1)));
final VisibilityAnnotationTag _tag = tag;
return new AnnotationElemBuilder() {
@Override
public void visitEnd() {
AnnotationTag annotTag = new AnnotationTag(desc, elems);
_tag.addAnnotation(annotTag);
}
};
}
示例3: parseFieldTags
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public static LinkedList<SootAnnotations.Annotation> parseFieldTags(SootField sf) {
List<Tag> tags = sf.getTags();
LinkedList<SootAnnotations.Annotation> annot = null;
for (Tag t : tags) {
if (t instanceof VisibilityAnnotationTag) {
if (annot!=null) {
throw new RuntimeException("Bug in parseFieldTags");
}
annot = parseAnnotations((VisibilityAnnotationTag)t);
} else if (t instanceof SignatureTag) {
//TODO: do we want to do something with that?
} else if (t instanceof StringConstantValueTag) {
} else if (t instanceof IntegerConstantValueTag) {
} else {
Log.debug("Unimplemented Tag found: "+t.getName());
}
}
if (annot == null) annot = new LinkedList<SootAnnotations.Annotation>();
return annot;
}
示例4: parseParameterAnnotations
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public static LinkedList<LinkedList<SootAnnotations.Annotation>> parseParameterAnnotations(SootMethod m) {
LinkedList<LinkedList<SootAnnotations.Annotation>> pannot = new LinkedList<LinkedList<SootAnnotations.Annotation>>();
for (Tag t : m.getTags()) {
if (t instanceof VisibilityParameterAnnotationTag) {
VisibilityParameterAnnotationTag tag = (VisibilityParameterAnnotationTag)t;
if (tag.getVisibilityAnnotations().size() != m.getParameterCount()) {
throw new RuntimeException("number of tags does not match number of params ... I did not understand this part!");
}
for (VisibilityAnnotationTag va : tag.getVisibilityAnnotations()) {
pannot.add(parseAnnotations(va));
}
}
}
return pannot;
}
示例5: parseAnnotations
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public void parseAnnotations(Unit u, int indx){
Set<String> annotationName = LogicBloxAnnotExporter.annotationName;
Map<Integer, List<Trio<String, String, String>>> pgmPtAnnot = LogicBloxAnnotExporter.pgmPtAnnot;
if(pgmPtAnnot.containsKey(indx))
return;
List<Trio<String, String, String>> annots = new ArrayList<Trio<String, String, String>>();
for(Tag t : u.getTags()){
if(t instanceof VisibilityAnnotationTag){
Map<String,List<Pair<String,String>>> parsed = SootUtilities.parseVisibilityAnnotationTag((VisibilityAnnotationTag)t);
for(String annotName : parsed.keySet()){
annotationName.add(annotName);
List<Pair<String,String>> keyValues = parsed.get(annotName);
for(Pair<String,String> p : keyValues){
annots.add(new Trio<String,String,String>(annotName,p.val0,p.val1));
}
}
}else if(t instanceof LineNumberTag){
LineNumberTag lnt = (LineNumberTag)t;
annotationName.add("LineNumberTag");
annots.add(new Trio<String,String,String>("LineNumberTag","LineNumber",Integer.toString(lnt.getLineNumber())) );
}
}
pgmPtAnnot.put(indx, annots);
}
示例6: parseAnnotations
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public void parseAnnotations(SootField f, int indx){
Set<String> annotationName = LogicBloxAnnotExporter.annotationName;
Map<Integer, List<Trio<String, String, String>>> fieldAnnot = LogicBloxAnnotExporter.fieldAnnot;
if(fieldAnnot.containsKey(indx))
return;
List<Trio<String, String, String>> annots = new ArrayList<Trio<String, String, String>>();
for(Tag t : f.getTags()){
if(t instanceof VisibilityAnnotationTag){
Map<String,List<Pair<String,String>>> parsed = SootUtilities.parseVisibilityAnnotationTag((VisibilityAnnotationTag)t);
for(String annotName : parsed.keySet()){
annotationName.add(annotName);
List<Pair<String,String>> keyValues = parsed.get(annotName);
for(Pair<String,String> p : keyValues){
annots.add(new Trio<String,String,String>(annotName,p.val0,p.val1));
}
}
}
}
fieldAnnot.put(indx, annots);
}
示例7: 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;
}
示例8: 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;
}
示例9: parseFieldTags
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public static LinkedList<SootAnnotations.Annotation> parseFieldTags(SootField sf) {
List<Tag> tags = sf.getTags();
LinkedList<SootAnnotations.Annotation> annot = null;
for (Tag t : tags) {
if (t instanceof VisibilityAnnotationTag) {
if (annot!=null) {
throw new RuntimeException("Bug in parseFieldTags");
}
annot = parseAnnotations((VisibilityAnnotationTag)t);
} else if (t instanceof SignatureTag) {
//TODO: do we want to do something with that?
} else if (t instanceof StringConstantValueTag) {
} else if (t instanceof IntegerConstantValueTag) {
} else {
Log.error("Unimplemented Tag found: "+t.getName());
}
}
if (annot == null) annot = new LinkedList<SootAnnotations.Annotation>();
return annot;
}
示例10: extractClassEffects
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final List<ILevel> extractClassEffects(SootClass sootClass) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootClass);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassEffects()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassEffects(),
at);
return definition.extractEffects(dao);
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_class_effects_error",
getSignatureOfClass(sootClass)),
e);
}
}
示例11: extractConstraints
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final Set<LEQConstraint> extractConstraints(SootMethod sootMethod) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootMethod);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassConstraints()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassConstraints(),
at);
return definition.extractConstraints(dao, sootMethod.getSignature());
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException
| AnnotationInvalidConstraintsException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_method_constraints_error",
getSignatureOfMethod(sootMethod)),
e);
}
}
示例12: extractFieldSecurityLevel
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final List<ILevel> extractFieldSecurityLevel(SootField sootField) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootField);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassFieldLevel()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassFieldLevel(),
at);
return definition.extractFieldLevel(dao);
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_field_level_error",
getSignatureOfField(sootField)),
e);
}
}
示例13: extractMethodEffects
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final List<ILevel> extractMethodEffects(SootMethod sootMethod) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootMethod);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassEffects()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassEffects(),
at);
return definition.extractEffects(dao);
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_method_effects_error",
getSignatureOfMethod(sootMethod)),
e);
}
}
示例14: extractParameterSecurityLevels
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final List<ILevel> extractParameterSecurityLevels(SootMethod sootMethod) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootMethod);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassParameterLevel()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassParameterLevel(),
at);
return definition.extractParameterLevels(dao);
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_method_parameter_error",
getSignatureOfMethod(sootMethod)),
e);
}
}
示例15: extractReturnSecurityLevel
import soot.tagkit.VisibilityAnnotationTag; //导入依赖的package包/类
public final ILevel extractReturnSecurityLevel(SootMethod sootMethod) {
try {
VisibilityAnnotationTag vt =
extractVisibilityAnnotationTag(sootMethod);
AnnotationTag at =
extractAnnotationTagWithType(vt,
getJNISignature(definition.getAnnotationClassReturnLevel()));
SootAnnotationDAO dao =
new SootAnnotationDAO(definition.getAnnotationClassReturnLevel(),
at);
return definition.extractReturnLevel(dao);
} catch (AnnotationExtractionException
| AnnotationElementNotFoundException e) {
throw new AnnotationExtractionException(getMsg("exception.annotation.extract_method_return_error",
getSignatureOfMethod(sootMethod)),
e);
}
}