OSDN Git Service

Mechanical refactoring of dx into two parts.
[android-x86/dalvik.git] / dx / src / com / android / dx / io / instructions / DecodedInstruction.java
index c526f87..e5b7073 100644 (file)
 
 package com.android.dx.io.instructions;
 
+import com.android.dex.DexException;
 import com.android.dx.io.IndexType;
 import com.android.dx.io.OpcodeInfo;
 import com.android.dx.io.Opcodes;
-import com.android.dx.util.DexException;
 import com.android.dx.util.Hex;
-
 import java.io.EOFException;
 
 /**
@@ -59,7 +58,7 @@ public abstract class DecodedInstruction {
 
     /**
      * literal value argument; also used for special verification error
-     * constants (formats 20bc and 40sc) as well as should-be-zero values
+     * constants (format 20bc) as well as should-be-zero values
      * (formats 10x, 20t, 30t, and 32x)
      */
     private final long literal;
@@ -90,7 +89,7 @@ public abstract class DecodedInstruction {
                 decoded[in.cursor()] = DecodedInstruction.decode(in);
             }
         } catch (EOFException ex) {
-            throw new AssertionError("shouldn't happen");
+            throw new DexException(ex);
         }
 
         return decoded;
@@ -202,7 +201,7 @@ public abstract class DecodedInstruction {
      * throw if the value is out of the range of a signed int.
      */
     public final int getLiteralInt() {
-        if (literal != (int) target) {
+        if (literal != (int) literal) {
             throw new DexException("Literal out of range: " + Hex.u8(literal));
         }
 
@@ -214,7 +213,7 @@ public abstract class DecodedInstruction {
      * value is out of the range of a signed code unit.
      */
     public final short getLiteralUnit() {
-        if (literal != (short) target) {
+        if (literal != (short) literal) {
             throw new DexException("Literal out of range: " + Hex.u8(literal));
         }
 
@@ -226,7 +225,7 @@ public abstract class DecodedInstruction {
      * throw if the value is out of the range of a signed byte.
      */
     public final int getLiteralByte() {
-        if (literal != (byte) target) {
+        if (literal != (byte) literal) {
             throw new DexException("Literal out of range: " + Hex.u8(literal));
         }