Add missing @Nonnull attributes for various EncodedValue.getValue() methods

This commit is contained in:
Ben Gruver 2013-04-28 01:11:23 -07:00
parent 1bf6f23245
commit 3c3a3c4af8
10 changed files with 13 additions and 17 deletions

View File

@ -79,8 +79,7 @@ public abstract class DexBackedEncodedValue {
return new DexBackedStringEncodedValue(reader, valueArg); return new DexBackedStringEncodedValue(reader, valueArg);
case ValueType.TYPE: case ValueType.TYPE:
Preconditions.checkValueArg(valueArg, 3); Preconditions.checkValueArg(valueArg, 3);
return new ImmutableTypeEncodedValue(reader.dexBuf.getType( return new DexBackedTypeEncodedValue(reader, valueArg);
reader.readSizedSmallUint(valueArg + 1)));
case ValueType.FIELD: case ValueType.FIELD:
Preconditions.checkValueArg(valueArg, 3); Preconditions.checkValueArg(valueArg, 3);
return new DexBackedFieldEncodedValue(reader, valueArg); return new DexBackedFieldEncodedValue(reader, valueArg);

View File

@ -48,7 +48,7 @@ public class DexBackedEnumEncodedValue extends BaseEnumEncodedValue {
fieldIndex = reader.readSizedSmallUint(valueArg + 1); fieldIndex = reader.readSizedSmallUint(valueArg + 1);
} }
@Override public FieldReference getValue() { @Nonnull @Override public FieldReference getValue() {
return new DexBackedFieldReference(dexFile, fieldIndex); return new DexBackedFieldReference(dexFile, fieldIndex);
} }
} }

View File

@ -48,7 +48,7 @@ public class DexBackedFieldEncodedValue extends BaseFieldEncodedValue {
fieldIndex = reader.readSizedSmallUint(valueArg + 1); fieldIndex = reader.readSizedSmallUint(valueArg + 1);
} }
@Override public FieldReference getValue() { @Nonnull @Override public FieldReference getValue() {
return new DexBackedFieldReference(dexFile, fieldIndex); return new DexBackedFieldReference(dexFile, fieldIndex);
} }
} }

View File

@ -48,7 +48,7 @@ public class DexBackedMethodEncodedValue extends BaseMethodEncodedValue {
MethodIndex = reader.readSizedSmallUint(valueArg + 1); MethodIndex = reader.readSizedSmallUint(valueArg + 1);
} }
@Override public MethodReference getValue() { @Nonnull @Override public MethodReference getValue() {
return new DexBackedMethodReference(dexFile, MethodIndex); return new DexBackedMethodReference(dexFile, MethodIndex);
} }
} }

View File

@ -46,7 +46,7 @@ public class DexBackedStringEncodedValue extends BaseStringEncodedValue {
stringIndex = reader.readSizedSmallUint(valueArg + 1); stringIndex = reader.readSizedSmallUint(valueArg + 1);
} }
@Override public String getValue() { @Nonnull @Override public String getValue() {
return dexFile.getString(stringIndex); return dexFile.getString(stringIndex);
} }
} }

View File

@ -46,7 +46,7 @@ public class DexBackedTypeEncodedValue extends BaseTypeEncodedValue {
typeIndex = reader.readSizedSmallUint(valueArg + 1); typeIndex = reader.readSizedSmallUint(valueArg + 1);
} }
@Override public String getValue() { @Nonnull @Override public String getValue() {
return dexFile.getType(typeIndex); return dexFile.getType(typeIndex);
} }
} }

View File

@ -47,7 +47,7 @@ public interface EnumEncodedValue extends EncodedValue {
* *
* @return a reference to the field on the enum class that holds the enum value, as a FieldReference * @return a reference to the field on the enum class that holds the enum value, as a FieldReference
*/ */
FieldReference getValue(); @Nonnull FieldReference getValue();
/** /**
* Returns a hashcode for this EncodedEnumValue. * Returns a hashcode for this EncodedEnumValue.

View File

@ -45,7 +45,7 @@ public interface FieldEncodedValue extends EncodedValue {
* *
* @return the field value as a FieldReference * @return the field value as a FieldReference
*/ */
FieldReference getValue(); @Nonnull FieldReference getValue();
/** /**
* Returns a hashcode for this EncodedFieldValue. * Returns a hashcode for this EncodedFieldValue.
@ -59,8 +59,7 @@ public interface FieldEncodedValue extends EncodedValue {
* *
* @return The hash code value for this EncodedFieldValue * @return The hash code value for this EncodedFieldValue
*/ */
@Override @Override int hashCode();
int hashCode();
/** /**
* Compares this FieldEncodedValue to another FieldEncodedValue for equality. * Compares this FieldEncodedValue to another FieldEncodedValue for equality.
@ -70,8 +69,7 @@ public interface FieldEncodedValue extends EncodedValue {
* @param o The object to be compared for equality with this FieldEncodedValue * @param o The object to be compared for equality with this FieldEncodedValue
* @return true if the specified object is equal to this FieldEncodedValue * @return true if the specified object is equal to this FieldEncodedValue
*/ */
@Override @Override boolean equals(@Nullable Object o);
boolean equals(@Nullable Object o);
/** /**
* Compare this FieldEncodedValue to another EncodedValue. * Compare this FieldEncodedValue to another EncodedValue.
@ -82,6 +80,5 @@ public interface FieldEncodedValue extends EncodedValue {
* @param o The EncodedValue to compare with this FieldEncodedValue * @param o The EncodedValue to compare with this FieldEncodedValue
* @return An integer representing the result of the comparison * @return An integer representing the result of the comparison
*/ */
@Override @Override int compareTo(@Nonnull EncodedValue o);
int compareTo(@Nonnull EncodedValue o);
} }

View File

@ -43,7 +43,7 @@ public interface StringEncodedValue extends EncodedValue {
* *
* @return the string value * @return the string value
*/ */
String getValue(); @Nonnull String getValue();
/** /**
* Returns a hashcode for this EncodedStringValue. * Returns a hashcode for this EncodedStringValue.

View File

@ -43,7 +43,7 @@ public interface TypeEncodedValue extends EncodedValue {
* *
* @return the type value * @return the type value
*/ */
String getValue(); @Nonnull String getValue();
/** /**
* Returns a hashcode for this EncodedTypeValue. * Returns a hashcode for this EncodedTypeValue.