/** * Adds an element to this instance. There must not already be an * element of the same type. * * @param annotation {@code non-null;} the element to add * @throws IllegalArgumentException thrown if there is a duplicate type */ public void add(Annotation annotation) { throwIfImmutable(); if (annotation == null) { throw new NullPointerException("annotation == null"); } CstType type = annotation.getType(); if (annotations.containsKey(type)) { throw new IllegalArgumentException("duplicate type: " + type.toHuman()); } annotations.put(type, annotation); }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** {@inheritDoc} */ public void addContents(DexFile file) { type = file.getTypeIds().intern(annotation.getType()); ValueEncoder.addContents(file, annotation); }
/** * Inspects a class annotation. * * @param cf {@code non-null;} class file * @param ann {@code non-null;} annotation */ private void visitClassAnnotation(DirectClassFile cf, BaseAnnotations ann) { if (!args.eTypes.contains(ElementType.TYPE)) { return; } for (Annotation anAnn : ann.getAnnotations().getAnnotations()) { String annClassName = anAnn.getType().getClassType().getClassName(); if (args.aclass.equals(annClassName)) { printMatch(cf); } } }
private static Annotation getAnnotation(AttributeList attrs, Class<?> annotationClazz) { BaseAnnotations a= (BaseAnnotations) attrs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME); if (a != null) { String annotationName= getClassWithSlashes(annotationClazz); for (Annotation an : a.getAnnotations().getAnnotations()) { if (an.getType().getClassType().getClassName().equals(annotationName)) { return an; } } } return null; }
/** * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * * @param file {@code non-null;} the file to add to * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); typeIds.intern(annotation.getType()); for (NameValuePair pair : annotation.getNameValuePairs()) { stringIds.intern(pair.getName()); addContents(file, pair.getValue()); } }
/** * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * * @param file {@code non-null;} the file to add to * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); typeIds.intern(annotation.getType()); for (NameValuePair pair : annotation.getNameValuePairs()) { stringIds.intern(pair.getName()); addContents(file, pair.getValue()); } }
/** * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * * @param file {@code non-null;} the file to add to * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); typeIds.intern(annotation.getType()); for (NameValuePair pair : annotation.getNameValuePairs()) { stringIds.intern(pair.getName()); addContents(file, pair.getValue()); } }
/** * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * * @param file {@code non-null;} the file to add to * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); typeIds.intern(annotation.getType()); for (NameValuePair pair : annotation.getNameValuePairs()) { stringIds.intern(pair.getName()); addContents(file, pair.getValue()); } }
/** * Helper for {@code addContents()} methods, which adds * contents for a particular {@link Annotation}, calling itself * recursively should it encounter a nested annotation. * * @param file {@code non-null;} the file to add to * @param annotation {@code non-null;} the annotation to add contents for */ public static void addContents(DexFile file, Annotation annotation) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); typeIds.intern(annotation.getType()); for (NameValuePair pair : annotation.getNameValuePairs()) { stringIds.intern(pair.getName()); addContents(file, pair.getValue()); } }
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }