auto import from //branches/cupcake_rel/...@138607
diff --git a/tools/dex-tools/src/dex/structure/DexAnnotatedElement.java b/tools/dex-tools/src/dex/structure/DexAnnotatedElement.java
new file mode 100644
index 0000000..0b69ca8
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexAnnotatedElement.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.util.Set;
+
+/**
+ * {@code DexAnnotatedElement} is implemented by all Elements that could have
+ * attached annotations.
+ */
+public interface DexAnnotatedElement {
+
+ /**
+ * Returns a list of {@code DexAnnotation} elements.
+ *
+ * @return a list of {@code DexAnnotation} elements
+ */
+ Set<DexAnnotation> getAnnotations();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexAnnotation.java b/tools/dex-tools/src/dex/structure/DexAnnotation.java
new file mode 100644
index 0000000..9cd372d
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexAnnotation.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.util.List;
+
+/**
+ * {@code DexAnnotation} represents an annotation.
+ */
+public interface DexAnnotation {
+
+ /**
+ * {@code Visibility} indicates the retention of a {@code DexAnnotation}.
+ */
+ enum Visibility {
+ /**
+ * Intended only to be visible at build time (e.g., during compilation
+ * of other code).
+ */
+ VISIBILITY_BUILD((byte) 0x00),
+ /**
+ * Intended to be visible at runtime. FIXME missing words in spec
+ */
+ VISIBILITY_RUNTIME((byte) 0X01),
+ /**
+ * Intended to be visible at runtime, but only to the underlying system
+ * (and not to regular user code). FIXME missing words in spec
+ */
+ VISIBILITY_SYSTEM((byte) 0x02);
+
+ @SuppressWarnings("unused")
+ private byte value;
+
+ private Visibility(byte value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the {@code Visibility} identified by the given {@code byte}.
+ * pre: 0 <= {@code value} <=2
+ *
+ * @param value
+ * the {@code byte} value which identifies a {@code
+ * Visibility}
+ * @return the {@code Visibility} for the given {@code byte}
+ */
+ public static Visibility get(byte value) {
+ // FIXME loop and compare instead of switch?
+ switch (value) {
+ case 0x00:
+ return VISIBILITY_BUILD;
+ case 0x01:
+ return VISIBILITY_RUNTIME;
+ case 0x02:
+ return VISIBILITY_SYSTEM;
+ default:
+ throw new IllegalArgumentException("Visibility doesn't exist!");
+ }
+ }
+ }
+
+ /**
+ * Returns the {@code Visibility} of this {@code DexAnnotation}.
+ *
+ * @return the {@code Visibility} of this {@code DexAnnotation}
+ */
+ Visibility getVisibility();
+
+ /**
+ * Returns the attributes of this {@code DexAnnotation}.
+ *
+ * @return the attributes of this {@code DexAnnotation}
+ */
+ List<DexAnnotationAttribute> getAttributes();
+
+ /**
+ * Returns the class name of this {@code DexAnnotation}.
+ *
+ * @return the class name of this {@code DexAnnotation}
+ */
+ String getTypeName();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexAnnotationAttribute.java b/tools/dex-tools/src/dex/structure/DexAnnotationAttribute.java
new file mode 100644
index 0000000..4d51c08
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexAnnotationAttribute.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code DexAnnotationValue} is implemented by annotation values. In the
+ * following example:
+ *
+ * <pre>
+ * @Text(value="hello")
+ * </pre>
+ *
+ * 'value="hello"' is represented by a {@code DexAnnotationValue}. "value" is
+ * its name and "hello" is its encoded value.
+ */
+public interface DexAnnotationAttribute extends NamedElement {
+ /**
+ * Returns the encoded value of this {@code DexAnnotationValue}.
+ *
+ * @return the encoded value of this {@code DexAnnotationValue}
+ */
+ public DexEncodedValue getEncodedValue();
+
+ public DexAnnotation getAnnotation();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexClass.java b/tools/dex-tools/src/dex/structure/DexClass.java
new file mode 100644
index 0000000..198f4ee
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexClass.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.util.List;
+
+/**
+ * {@code DexClass} represents a class.
+ */
+public interface DexClass extends DexAnnotatedElement, WithModifiers,
+ NamedElement {
+ /**
+ * Returns a list containing the names of all implemented interfaces.
+ *
+ * @return a list containing the names of all implemented interfaces
+ */
+ List<String> getInterfaces();
+
+ /**
+ * Returns the name of the super class.
+ *
+ * @return the name of the super class, maybe {@code null}
+ */
+ String getSuperClass();
+
+ /**
+ * Returns a list containing all fields declared by this {@code DexClass}.
+ *
+ * @return a list containing all fields declared by this {@code DexClass}
+ */
+ List<DexField> getFields();
+
+ /**
+ * Returns a list containing all methods declared by this {@code DexClass}.
+ *
+ * @return a list containing all methods declared by this {@code DexClass}
+ */
+ List<DexMethod> getMethods();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexEncodedAnnotation.java b/tools/dex-tools/src/dex/structure/DexEncodedAnnotation.java
new file mode 100644
index 0000000..f31fe74
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexEncodedAnnotation.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.util.List;
+
+public interface DexEncodedAnnotation extends DexEncodedValue {
+ String getTypeName();
+
+ List<DexAnnotationAttribute> getValue();
+
+}
diff --git a/tools/dex-tools/src/dex/structure/DexEncodedValue.java b/tools/dex-tools/src/dex/structure/DexEncodedValue.java
new file mode 100644
index 0000000..1d09f34
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexEncodedValue.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code DexEncodedValue} represents an encoded value. The value of a {@code
+ * DexAnnotationValue} is encoded as {@code DexEncodedValue}.
+ */
+public interface DexEncodedValue {
+
+ /**
+ * Returns the type of this {@code DexEncodedValue}.
+ *
+ * @return the type of this {@code DexEncodedValue}
+ */
+ DexEncodedValueType getType();
+
+ /**
+ * Returns the value of this {@code DexEncodedValue}.
+ *
+ * @return the value of this {@code DexEncodedValue}
+ */
+ Object getValue();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexEncodedValueType.java b/tools/dex-tools/src/dex/structure/DexEncodedValueType.java
new file mode 100644
index 0000000..00560f3
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexEncodedValueType.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code DexEncodedValueType} represents the type of an {code DexEncodedValue}.
+ */
+public enum DexEncodedValueType {
+ /**
+ * <pre>
+ * VALUE_BYTE 0x00 (none; must be 0) ubyte[1]
+ * </pre>
+ *
+ * signed one-byte integer value
+ */
+ VALUE_BYTE((byte) 0x00),
+ /**
+ * <pre>
+ * VALUE_SHORT 0x02 size - 1 (0...1) ubyte[size]
+ * </pre>
+ *
+ * signed two-byte integer value, sign-extended
+ */
+ VALUE_SHORT((byte) 0x02),
+ /**
+ * <pre>
+ * VALUE_CHAR 0x03 size - 1 (0...1) ubyte[size]
+ * </pre>
+ *
+ * unsigned two-byte integer value, zero-extended
+ */
+ VALUE_CHAR((byte) 0x03),
+ /**
+ * <pre>
+ * VALUE_INT 0x04 size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * signed four-byte integer value, sign-extended
+ */
+ VALUE_INT((byte) 0x04),
+ /**
+ * <pre>
+ * VALUE_LONG 0x06 size - 1 (0...7) ubyte[size]
+ * </pre>
+ *
+ * signed eight-byte integer value, sign-extended
+ */
+ VALUE_LONG((byte) 0x06),
+ /**
+ * <pre>
+ * VALUE_FLOAT 0x10 size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * four-byte bit pattern, zero-extended to the right, and interpreted as an
+ * IEEE754 32-bit floating point value
+ */
+ VALUE_FLOAT((byte) 0x10),
+ /**
+ * <pre>
+ * VALUE_DOUBLE 0x11 size - 1 (0...7) ubyte[size]
+ * </pre>
+ *
+ * eight-byte bit pattern, zero-extended to the right, and interpreted as an
+ * IEEE754 64-bit floating point value
+ */
+ VALUE_DOUBLE((byte) 0x11),
+ /**
+ * <pre>
+ * VALUE_STRING 0x17 size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * unsigned (zero-extended) four-byte integer value, interpreted as an index
+ * into the string_ids section and representing a string value
+ */
+ VALUE_STRING((byte) 0x17),
+ /**
+ * <pre>
+ * VALUE_TYPE 0x18 size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * unsigned (zero-extended) four-byte integer value, interpreted as an index
+ * into the type_ids section and representing a reflective type/class value
+ */
+ VALUE_TYPE((byte) 0x18),
+ /**
+ * <pre>
+ * VALUE_FIELD 0x19 size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * unsigned (zero-extended) four-byte integer value, interpreted as an index
+ * into the field_ids section and representing a reflective field value
+ */
+ VALUE_FIELD((byte) 0x19),
+ /**
+ * <pre>
+ * VALUE_METHOD 0x1a size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * unsigned (zero-extended) four-byte integer value, interpreted as an index
+ * into the method_ids section and representing a reflective method value
+ */
+ VALUE_METHOD((byte) 0x1a),
+ /**
+ * <pre>
+ * VALUE_ENUM 0x1b size - 1 (0...3) ubyte[size]
+ * </pre>
+ *
+ * unsigned (zero-extended) four-byte integer value, interpreted as an index
+ * into the field_ids section and representing the value of an enumerated
+ * type constant
+ */
+ VALUE_ENUM((byte) 0x1b),
+ /**
+ * <pre>
+ * VALUE_ARRAY 0x1c (none; must be 0) encoded_array
+ * </pre>
+ *
+ * an array of values, in the format specified by "encoded_array Format"
+ * below. The size of the value is implicit in the encoding.
+ */
+ VALUE_ARRAY((byte) 0x1c),
+ /**
+ * <pre>
+ * VALUE_ANNOTATION 0x1d (none; must be 0) encoded_annotation
+ * </pre>
+ *
+ * a sub-annotation, in the format specified by "encoded_annotation Format"
+ * below. The size of the value is implicit in the encoding.
+ */
+ VALUE_ANNOTATION((byte) 0x1d),
+ /**
+ * <pre>
+ * VALUE_NULL 0x1e (none; must be 0) (none)
+ * </pre>
+ *
+ * null reference value
+ */
+ VALUE_NULL((byte) 0x1e),
+ /**
+ * <pre>
+ * VALUE_BOOLEAN 0x1f boolean (0...1) (none)
+ * </pre>
+ *
+ * one-bit value; 0 for false and 1 for true. The bit is represented in the
+ * value_arg.
+ */
+ VALUE_BOOLEAN((byte) 0x1f);
+
+ private byte value;
+
+ /**
+ * Creates a new instance of {@code DexEncodedValueType} using the provided
+ * byte.
+ * <p>
+ * Format: value := (value_arg << 5) | value_type
+ *
+ * @param value
+ * the {@code byte} containing the type and the value argument
+ */
+ private DexEncodedValueType(byte value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the {@code DexEncodedValueType} for the given {@code byte}.
+ *
+ * @param value
+ * the {@code byte} containing the type and the value argument
+ * @return the {@code DexEncodedValueType} for the given {@code byte}
+ */
+ public static DexEncodedValueType get(byte value) {
+ // FIXME don't loop -> switch to get performance boost
+ for (DexEncodedValueType type : values()) {
+ if (type.value == (value & 0x1F)) {
+ return type;
+ }
+ }
+ throw new IllegalArgumentException("Type does not exist!");
+ }
+
+ /**
+ * Returns the value argument of the given {@code byte}.
+ * <p>
+ * Format: value := (value_arg << 5) | value_type
+ *
+ * @param value
+ * the {@code byte} containing the type and the value argument
+ * @return the value argument of the given {@code byte}
+ */
+ public static byte valueArg(byte value) {
+ return (byte) (value >>> 5);
+ }
+}
diff --git a/tools/dex-tools/src/dex/structure/DexField.java b/tools/dex-tools/src/dex/structure/DexField.java
new file mode 100644
index 0000000..419bfad
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexField.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code DexField} represents a field.
+ */
+public interface DexField extends DexAnnotatedElement, WithModifiers,
+ NamedElement {
+
+ /**
+ * Returns the name of the type of this {@code DexField}.
+ *
+ * @return the name of the type of this {@code DexField}
+ */
+ String getType();
+
+ DexClass getDeclaringClass();
+
+ boolean isEnumConstant();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexFile.java b/tools/dex-tools/src/dex/structure/DexFile.java
new file mode 100644
index 0000000..f7ee50e
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexFile.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+
+import java.util.List;
+
+/**
+ * {@code DexFile} represents a whole dex file, containing multiple classes.
+ */
+public interface DexFile extends NamedElement {
+
+ /**
+ * Returns a list of {@code DexClass} elements that are part of this {@code
+ * DexFile}.
+ *
+ * @return a list of {@code DexClass} elements that are part of this {@code
+ * DexFile}
+ */
+ public List<DexClass> getDefinedClasses();
+
+}
diff --git a/tools/dex-tools/src/dex/structure/DexInterface.java b/tools/dex-tools/src/dex/structure/DexInterface.java
new file mode 100644
index 0000000..639b14d
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexInterface.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code DexInterface} represents an interface.
+ */
+public interface DexInterface extends DexAnnotatedElement {
+}
diff --git a/tools/dex-tools/src/dex/structure/DexMethod.java b/tools/dex-tools/src/dex/structure/DexMethod.java
new file mode 100644
index 0000000..a2e3a09
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexMethod.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.util.List;
+
+/**
+ * {@code DexMethod} represents a method.
+ */
+public interface DexMethod extends WithModifiers, DexAnnotatedElement,
+ NamedElement {
+ /**
+ * Returns a list of strings representing the types of the parameters of
+ * this method.
+ *
+ * @return a list of strings representing the types of the parameters of
+ * this method
+ */
+ public List<DexParameter> getParameters();
+
+ public String getReturnType();
+
+ public DexClass getDeclaringClass();
+}
diff --git a/tools/dex-tools/src/dex/structure/DexParameter.java b/tools/dex-tools/src/dex/structure/DexParameter.java
new file mode 100644
index 0000000..22a21e0
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/DexParameter.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+public interface DexParameter extends DexAnnotatedElement {
+ String getTypeName();
+}
diff --git a/tools/dex-tools/src/dex/structure/NamedElement.java b/tools/dex-tools/src/dex/structure/NamedElement.java
new file mode 100644
index 0000000..ab8b128
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/NamedElement.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+/**
+ * {@code NamedElement} represents an element with a name.
+ */
+public interface NamedElement {
+ /**
+ * Returns the name of this {@code NamedElement}.
+ *
+ * @return the name of this {@code NamedElement}
+ */
+ String getName();
+}
diff --git a/tools/dex-tools/src/dex/structure/WithModifiers.java b/tools/dex-tools/src/dex/structure/WithModifiers.java
new file mode 100644
index 0000000..804c461
--- /dev/null
+++ b/tools/dex-tools/src/dex/structure/WithModifiers.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dex.structure;
+
+import java.lang.reflect.Modifier;
+
+/**
+ * {@link WithModifiers} is implemented by all language elements that have
+ * modifiers.
+ */
+public interface WithModifiers {
+
+ /**
+ * The {@link Modifier} class should be used to decode the result.
+ *
+ * @return the modifiers for this member
+ *
+ * @see Modifier
+ */
+ int getModifiers();
+}