private boolean hasRuntimeVisibleAnnotation(HasAttribute element) { Attribute att = element.getAttributes().findFirst( AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME); return (att != null && ((AttRuntimeVisibleAnnotations)att).getAnnotations().size()>0); } }
Annotation annotation = new Annotation(cstType, AnnotationVisibility.RUNTIME); Annotations annotations = new Annotations(); for (NameValuePair nvp : elements.values()) { annotation.add(nvp); annotations.add(annotation); classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
/** * Set an annotation element of this instance. * If there is a preexisting element with the same name, it will be * replaced by this method. * * @param element {@code non-null;} the annotation element to be set. */ public void set(Element element) { if (element == null) { throw new NullPointerException("element == null"); } CstString pairName = new CstString(element.getName()); Constant pairValue = Element.toConstant(element.getValue()); NameValuePair nameValuePair = new NameValuePair(pairName, pairValue); elements.put(element.getName(), nameValuePair); }
/** * Constructs a standard {@code SourceDebugExtension} annotation. * * @param smapString {@code non-null;} the SMAP string associated with * @return {@code non-null;} the annotation */ public static Annotation makeSourceDebugExtension(CstString smapString) { Annotation result = new Annotation(SOURCE_DEBUG_EXTENSION_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, smapString)); result.setImmutable(); return result; }
/** * Sets the element at the given index. The given element must be * immutable. * * @param n {@code >= 0, < size();} which index * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); set0(n, a); } }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, method)); result.setImmutable(); return result; }
/** * Sets the element at the given index. The given element must be * immutable. * * @param n {@code >= 0, < size();} which index * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); set0(n, a); } }
/** * Constructs a standard {@code SourceDebugExtension} annotation. * * @param smapString {@code non-null;} the SMAP string associated with * @return {@code non-null;} the annotation */ public static Annotation makeSourceDebugExtension(CstString smapString) { Annotation result = new Annotation(SOURCE_DEBUG_EXTENSION_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, smapString)); result.setImmutable(); return result; }
/** * Sets the element at the given index. The given element must be * immutable. * * @param n {@code >= 0, < size();} which index * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); set0(n, a); } }
/** * Constructs a standard {@code EnclosingClass} annotation. * * @param clazz {@code non-null;} the enclosing class * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingClass(CstType clazz) { Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, clazz)); result.setImmutable(); return result; }
/** * Sets the element at the given index. The given element must be * immutable. * * @param n {@code >= 0, < size();} which index * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); set0(n, a); } }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_UTF, method)); result.setImmutable(); return result; }
/** * Sets the element at the given index. The given element must be * immutable. * * @param n {@code >= 0, < size();} which index * @param a {@code null-ok;} the element to set at {@code n} */ public void set(int n, Annotations a) { a.throwIfMutable(); set0(n, a); } }
/** * Constructs a standard {@code EnclosingClass} annotation. * * @param clazz {@code non-null;} the enclosing class * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingClass(CstType clazz) { Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, clazz)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingClass} annotation. * * @param clazz {@code non-null;} the enclosing class * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingClass(CstType clazz) { Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, clazz)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, method)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, method)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, method)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingClass} annotation. * * @param clazz {@code non-null;} the enclosing class * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingClass(CstType clazz) { Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, clazz)); result.setImmutable(); return result; }
/** * Constructs a standard {@code EnclosingMethod} annotation. * * @param method {@code non-null;} the enclosing method * @return {@code non-null;} the annotation */ public static Annotation makeEnclosingMethod(CstMethodRef method) { Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM); result.put(new NameValuePair(VALUE_STRING, method)); result.setImmutable(); return result; }