Add initial support for allowing assembly of odex instructions

Initially, only throw-verification-error is supported
This commit is contained in:
Ben Gruver
2011-10-09 22:33:37 -04:00
parent bbe539f2d2
commit 94e5a39ad2
4 changed files with 73 additions and 5 deletions

View File

@ -28,6 +28,8 @@
package org.jf.dexlib.Code;
import java.util.HashMap;
public enum VerificationErrorType {
None(0, "no-error"),
Generic(1, "generic-error"),
@ -40,6 +42,16 @@ public enum VerificationErrorType {
ClassChange(8, "class-change-error"),
Instantiation(9, "instantiation-error");
private static HashMap<String, VerificationErrorType> verificationErrorTypesByName;
static {
verificationErrorTypesByName = new HashMap<String, VerificationErrorType>();
for (VerificationErrorType verificationErrorType: VerificationErrorType.values()) {
verificationErrorTypesByName.put(verificationErrorType.getName(), verificationErrorType);
}
}
private int value;
private String name;
private VerificationErrorType(int value, String name) {
@ -55,6 +67,10 @@ public enum VerificationErrorType {
return name;
}
public static VerificationErrorType fromString(String validationErrorType) {
return verificationErrorTypesByName.get(validationErrorType);
}
public static VerificationErrorType getValidationErrorType(int validationErrorType) {
switch (validationErrorType) {
case 0: