本文整理汇总了Java中soot.tagkit.AnnotationTag类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationTag类的具体用法?Java AnnotationTag怎么用?Java AnnotationTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationTag类属于soot.tagkit包,在下文中一共展示了AnnotationTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitAnnotation
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
};
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:31,代码来源:TagBuilder.java
示例2: addTagToList
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
private static void addTagToList(LinkedList<SootAnnotations.Annotation> annot, AnnotationTag at) {
if (at!=null) {
if (at.getType().contains("Lorg/eclipse/jdt/annotation/NonNull")) {
Log.info("@NonNull found" );
annot.add(Annotation.NonNull);
} else if (at.getType().contains("Lsun/reflect/CallerSensitive")) {
Log.debug("Not sure what to do with this tag. Ignoring it: "+at.getType());
} else if (at.getType().contains("Ljava/lang/SafeVarargs")) {
//TODO: we could actually check that!
Log.debug("Not sure what to do with this tag. Ignoring it: "+at.getType());
} else {
// Log.debug("Unhandled Annotation "+at);
}
} else {
//no annotation
}
}
开发者ID:SRI-CSL,项目名称:bixie,代码行数:19,代码来源:SootAnnotations.java
示例3: extractJUnitTestsHelper
import soot.tagkit.AnnotationTag; //导入依赖的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
示例4: parseVisibilityAnnotationTag
import soot.tagkit.AnnotationTag; //导入依赖的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
示例5: extractClassEffects
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:20,代码来源:ALevelMediator.java
示例6: extractConstraints
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:20,代码来源:ALevelMediator.java
示例7: extractFieldSecurityLevel
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:19,代码来源:ALevelMediator.java
示例8: extractMethodEffects
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:19,代码来源:ALevelMediator.java
示例9: extractParameterSecurityLevels
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:19,代码来源:ALevelMediator.java
示例10: extractReturnSecurityLevel
import soot.tagkit.AnnotationTag; //导入依赖的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);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:19,代码来源:ALevelMediator.java
示例11: isAtomicAnnotated
import soot.tagkit.AnnotationTag; //导入依赖的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
示例12: extractContractRaw
import soot.tagkit.AnnotationTag; //导入依赖的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
示例13: for
import soot.tagkit.AnnotationTag; //导入依赖的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
示例14: getVisibilityAnnotationAttr
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
private String getVisibilityAnnotationAttr(VisibilityAnnotationTag tag){
StringBuffer sb = new StringBuffer();
if(tag == null){
return "";
}else
if (tag.getVisibility() == AnnotationConstants.RUNTIME_VISIBLE){
sb.append(".runtime_visible_annotation\n");
}
else if(tag.getVisibility() == AnnotationConstants.RUNTIME_INVISIBLE){
sb.append(".runtime_invisible_annotation\n");
} else {
//source level annotation
return "";
}
if (tag.hasAnnotations()){
Iterator<AnnotationTag> it = tag.getAnnotations().iterator();
while (it.hasNext()){
AnnotationTag annot = it.next();
sb.append(".annotation ");
sb.append(soot.util.StringTools.getQuotedStringOf(annot.getType())+"\n");
for (AnnotationElem ae : annot.getElems()){
sb.append(getElemAttr(ae));
}
sb.append(".end .annotation\n");
}
}
sb.append(".end .annotation_attr\n");
return sb.toString();
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:30,代码来源:AbstractJasminClass.java
示例15: visitAnnotation
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
@Override
public AnnotationVisitor visitAnnotation(final String name, final String desc) {
return new AnnotationElemBuilder() {
@Override
public void visitEnd() {
AnnotationTag tag = new AnnotationTag(desc, elems);
AnnotationElemBuilder.this.elems.add(new AnnotationAnnotationElem(tag, '@', name));
}
};
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:AnnotationElemBuilder.java
示例16: parseAnnotations
import soot.tagkit.AnnotationTag; //导入依赖的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
示例17: GenericCallerSensitive
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
public GenericCallerSensitive() {
for (Iterator<MethodOrMethodContext> iter = Scene.v().getReachableMethods().listener(); iter.hasNext();) {
SootMethod m = iter.next().method();
for (Tag tag : m.getTags()) {
if (tag instanceof VisibilityAnnotationTag) {
for (AnnotationTag annotation : ((VisibilityAnnotationTag) tag).getAnnotations()) {
if (annotation.getType().equals("Lsun/reflect/CallerSensitive;")) {
if (hasTaintableValueForDirection(FORWARDS, m) && hasTaintableValueForDirection(BACKWARDS, m))
sensitiveMethods.add(m);
}
}
}
}
}
}
开发者ID:johanneslerch,项目名称:FlowTwist,代码行数:16,代码来源:GenericCallerSensitive.java
示例18: SootAnnotationDAO
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
public SootAnnotationDAO(Class<? extends Annotation> annotationClass,
AnnotationTag annotation) {
this.type = annotationClass;
for (int i = 0; i < annotation.getNumElems(); i++) {
AnnotationElem ae = annotation.getElemAt(i);
this.elements.put(ae.getName(), ae);
}
}
开发者ID:proglang,项目名称:jgs,代码行数:9,代码来源:SootAnnotationDAO.java
示例19: convertAnnotation
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
private SootAnnotationDAO convertAnnotation(AnnotationElem ae,
Class<? extends Annotation> annotationClass) {
AnnotationAnnotationElem aae = (AnnotationAnnotationElem) ae;
AnnotationTag at = aae.getValue();
if (at.getType().equals(getJNISignature(annotationClass))) {
return new SootAnnotationDAO(annotationClass, at);
}
throw new AnnotationElementNotFoundException(getMsg("exception.annotation.invalid_annotation_type",
annotationClass.getName()));
}
开发者ID:proglang,项目名称:jgs,代码行数:11,代码来源:SootAnnotationDAO.java
示例20: generateArrayCreatorConstraints
import soot.tagkit.AnnotationTag; //导入依赖的package包/类
private Set<LEQConstraint> generateArrayCreatorConstraints(SootMethod sootMethod) {
Set<LEQConstraint> constraints = new HashSet<LEQConstraint>();
VisibilityAnnotationTag vat =
AnalysisUtils.extractVisibilityAnnotationTag(sootMethod);
AnnotationTag at =
AnalysisUtils.extractAnnotationTagWithType(vat,
AnalysisUtils.getJNISignature(ArrayCreator.class));
IAnnotationDAO dao = new SootAnnotationDAO(ArrayCreator.class, at);
List<String> stringLevels = dao.getStringArrayFor("value");
List<ILevel> levels = mediator.translateNamesIntoLevels(stringLevels);
ComponentReturnRef retRef =
new ComponentReturnRef(sootMethod.getSignature());
if (levels.size() > 0) {
constraints.add(new LEQConstraint(new ComponentParameterRef(0,
sootMethod.getSignature()),
retRef));
}
for (int i = 0; i < sootMethod.getParameterCount(); i++) {
int j = i + 1;
ComponentParameterRef paramRef =
new ComponentParameterRef(j, sootMethod.getSignature());
ComponentArrayRef arrayRef = new ComponentArrayRef(retRef, j);
constraints.add(new LEQConstraint(levels.get(i), arrayRef));
constraints.add(new LEQConstraint(arrayRef, levels.get(i)));
if (j < sootMethod.getParameterCount()) {
constraints.add(new LEQConstraint(paramRef, arrayRef));
}
}
return constraints;
}
开发者ID:proglang,项目名称:jgs,代码行数:31,代码来源:AnnotationExtractor.java
注:本文中的soot.tagkit.AnnotationTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论