Don't compare encoded values with item references by item index
diff --git a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/EnumEncodedValue.java b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/EnumEncodedValue.java
index 9d72064..7cd1f45 100644
--- a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/EnumEncodedValue.java
+++ b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/EnumEncodedValue.java
@@ -80,7 +80,7 @@
     protected int compareValue(EncodedValue o) {
         EnumEncodedValue other = (EnumEncodedValue)o;
 
-        return value.getIndex() - other.value.getIndex();
+        return value.compareTo(other.value);
     }
 
     /** {@inheritDoc} */
diff --git a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/FieldEncodedValue.java b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/FieldEncodedValue.java
index 4d0de57..6aafc62 100644
--- a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/FieldEncodedValue.java
+++ b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/FieldEncodedValue.java
@@ -80,7 +80,7 @@
     protected int compareValue(EncodedValue o) {
         FieldEncodedValue other = (FieldEncodedValue)o;
 
-        return value.getIndex()-other.value.getIndex();
+        return value.compareTo(other.value);
     }
 
     /** {@inheritDoc} */
diff --git a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/MethodEncodedValue.java b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/MethodEncodedValue.java
index 6267ed6..e23450a 100644
--- a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/MethodEncodedValue.java
+++ b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/MethodEncodedValue.java
@@ -80,7 +80,7 @@
     protected int compareValue(EncodedValue o) {
         MethodEncodedValue other = (MethodEncodedValue)o;
 
-        return value.getIndex() - other.value.getIndex();
+        return value.compareTo(other.value);
     }
 
     /** {@inheritDoc} */
diff --git a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/StringEncodedValue.java b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/StringEncodedValue.java
index d45c106..8b32394 100644
--- a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/StringEncodedValue.java
+++ b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/StringEncodedValue.java
@@ -81,7 +81,7 @@
     protected int compareValue(EncodedValue o) {
         StringEncodedValue other = (StringEncodedValue)o;
 
-        return value.getIndex() - other.value.getIndex();
+        return value.compareTo(other.value);
     }
 
     /** {@inheritDoc} */
diff --git a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/TypeEncodedValue.java b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/TypeEncodedValue.java
index 0b5dcbb..335aab6 100644
--- a/dexlib/src/main/java/org/jf/dexlib/EncodedValue/TypeEncodedValue.java
+++ b/dexlib/src/main/java/org/jf/dexlib/EncodedValue/TypeEncodedValue.java
@@ -80,7 +80,7 @@
     protected int compareValue(EncodedValue o) {
         TypeEncodedValue other = (TypeEncodedValue)o;
 
-        return value.getIndex() - other.value.getIndex();
+        return value.compareTo(other.value);
     }
 
     /** {@inheritDoc} */