diff --git a/dexlib2/src/main/java/org/jf/dexlib2/iface/Annotation.java b/dexlib2/src/main/java/org/jf/dexlib2/iface/Annotation.java index 810fb048..251ac123 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/iface/Annotation.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/iface/Annotation.java @@ -38,7 +38,7 @@ import java.util.Set; /** * This class represents a specific instance of an annotation applied to a class/field/method/parameter */ -public interface Annotation extends Comparable { +public interface Annotation extends BasicAnnotation, Comparable { /** * Gets the visibility of this annotation. * diff --git a/dexlib2/src/main/java/org/jf/dexlib2/iface/BasicAnnotation.java b/dexlib2/src/main/java/org/jf/dexlib2/iface/BasicAnnotation.java new file mode 100644 index 00000000..4433b6a6 --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/iface/BasicAnnotation.java @@ -0,0 +1,27 @@ +package org.jf.dexlib2.iface; + +import javax.annotation.Nonnull; +import java.util.Set; + +/** + * This represents a basic annotation, and serves as a common superclass for Annotation and AnnotationEncodedValue + */ +public interface BasicAnnotation { + /** + * Gets the type of this annotation. + * + * This will be the type descriptor of the class that defines this annotation. + * + * @return The type of this annotation + */ + @Nonnull String getType(); + + /** + * Gets a set of the name/value elements associated with this annotation. + * + * The elements in the returned set will be unique with respect to the element name. + * + * @return A set of AnnotationElements + */ + @Nonnull Set getElements(); +} diff --git a/dexlib2/src/main/java/org/jf/dexlib2/iface/value/AnnotationEncodedValue.java b/dexlib2/src/main/java/org/jf/dexlib2/iface/value/AnnotationEncodedValue.java index bda7583e..c59b387a 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/iface/value/AnnotationEncodedValue.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/iface/value/AnnotationEncodedValue.java @@ -32,6 +32,7 @@ package org.jf.dexlib2.iface.value; import org.jf.dexlib2.iface.AnnotationElement; +import org.jf.dexlib2.iface.BasicAnnotation; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -40,7 +41,7 @@ import java.util.Set; /** * This class represents an encoded annotation value. */ -public interface AnnotationEncodedValue extends EncodedValue { +public interface AnnotationEncodedValue extends EncodedValue, BasicAnnotation { /** * Gets the type of this annotation. *