mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Added better frame support
This commit is contained in:
1 parent
6e1a0a26b3
commit
0cb4461cc2
3 files changed
+360
-292
No files matched your search
@@ -581,7 +581,14 @@ public class Assembler {
|
|||||||
} else {
|
} else {
|
||||||
for (String asd : l.split(", ")) {
|
for (String asd : l.split(", ")) {
|
||||||
if (!asd.startsWith("(")) {
|
if (!asd.startsWith("(")) {
|
||||||
arr.add(UnicodeUtils.unescape(asd));
|
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||||
|
if (frameType != -1)
|
||||||
|
arr.add(new Integer(frameType));
|
||||||
|
else {
|
||||||
|
String frame = UnicodeUtils.unescape(asd);
|
||||||
|
frame = frame.substring(1, frame.length() - 1);
|
||||||
|
arr.add(frame);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (asd.startsWith("(label) ")) {
|
if (asd.startsWith("(label) ")) {
|
||||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||||
@@ -620,7 +627,14 @@ public class Assembler {
|
|||||||
} else {
|
} else {
|
||||||
for (String asd : st.split(", ")) {
|
for (String asd : st.split(", ")) {
|
||||||
if (!asd.startsWith("(")) {
|
if (!asd.startsWith("(")) {
|
||||||
arr.add(UnicodeUtils.unescape(asd));
|
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||||
|
if (frameType != -1)
|
||||||
|
arr.add(new Integer(frameType));
|
||||||
|
else {
|
||||||
|
String frame = UnicodeUtils.unescape(asd);
|
||||||
|
frame = frame.substring(1, frame.length() - 1);
|
||||||
|
arr.add(frame);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (asd.startsWith("(label) ")) {
|
if (asd.startsWith("(label) ")) {
|
||||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||||
|
|||||||
@@ -421,9 +421,15 @@ public class Disassembler {
|
|||||||
arr.add(null);
|
arr.add(null);
|
||||||
} else {
|
} else {
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
arr.add(UnicodeUtils.escapeWithSpaces((String) o));
|
arr.add("L" + UnicodeUtils.escapeWithSpaces((String) o) + ";");
|
||||||
} else if (o instanceof LabelNode) {
|
} else if (o instanceof LabelNode) {
|
||||||
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
||||||
|
} else if (o instanceof Integer) {
|
||||||
|
String frameType = ClassUtil.getFrameTypeByID(((Integer) o).intValue());
|
||||||
|
if (frameType != null)
|
||||||
|
arr.add(frameType);
|
||||||
|
else
|
||||||
|
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||||
} else {
|
} else {
|
||||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||||
}
|
}
|
||||||
@@ -441,9 +447,15 @@ public class Disassembler {
|
|||||||
arr.add(null);
|
arr.add(null);
|
||||||
} else {
|
} else {
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
arr.add(UnicodeUtils.escapeWithSpaces((String) o));
|
arr.add("L" + UnicodeUtils.escapeWithSpaces((String) o) + ";");
|
||||||
} else if (o instanceof LabelNode) {
|
} else if (o instanceof LabelNode) {
|
||||||
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
arr.add("(label) " + labels.get(((LabelNode) o).getLabel()));
|
||||||
|
} else if (o instanceof Integer) {
|
||||||
|
String frameType = ClassUtil.getFrameTypeByID(((Integer) o).intValue());
|
||||||
|
if (frameType != null)
|
||||||
|
arr.add(frameType);
|
||||||
|
else
|
||||||
|
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||||
} else {
|
} else {
|
||||||
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
arr.add("(" + o.getClass().getName().replace(".", "/") + ") " + o);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,34 +28,34 @@ public class ClassUtil {
|
|||||||
|
|
||||||
public static boolean isObjectClassMethod(String name, String desc, boolean forbidInits) {
|
public static boolean isObjectClassMethod(String name, String desc, boolean forbidInits) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "<init>":
|
case "<init>":
|
||||||
case "<clinit>":
|
case "<clinit>":
|
||||||
if (forbidInits) {
|
if (forbidInits) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "notifyAll":
|
case "notifyAll":
|
||||||
case "notify":
|
case "notify":
|
||||||
if (desc.equals("()V")) {
|
if (desc.equals("()V")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "wait":
|
case "wait":
|
||||||
if (desc.equals("()V") || desc.equals("(J)V") || desc.equals("(JI)V")) {
|
if (desc.equals("()V") || desc.equals("(J)V") || desc.equals("(JI)V")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "equals":
|
case "equals":
|
||||||
if (desc.equals("(Ljava/lang/Object;)Z")) {
|
if (desc.equals("(Ljava/lang/Object;)Z")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "hashCode":
|
case "hashCode":
|
||||||
if (desc.equals("()I")) {
|
if (desc.equals("()I")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -63,127 +63,167 @@ public class ClassUtil {
|
|||||||
public static int getIDFromClassNameForType(String s) {
|
public static int getIDFromClassNameForType(String s) {
|
||||||
s = s.toUpperCase();
|
s = s.toUpperCase();
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case "V": {
|
case "V": {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case "Z": {
|
case "Z": {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case "C": {
|
case "C": {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
case "B": {
|
case "B": {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
case "S": {
|
case "S": {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
case "I": {
|
case "I": {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
case "F": {
|
case "F": {
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
case "J": {
|
case "J": {
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
case "D": {
|
case "D": {
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
case "NAME": {
|
case "NAME": {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return Integer.parseInt(s);
|
return Integer.parseInt(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getClassNameFromType(Type type) {
|
public static String getClassNameFromType(Type type) {
|
||||||
switch (type.getSort()) {
|
switch (type.getSort()) {
|
||||||
case 0: {
|
case 0: {
|
||||||
return "V";
|
return "V";
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
return "Z";
|
return "Z";
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
return "C";
|
return "C";
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
return "B";
|
return "B";
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
return "S";
|
return "S";
|
||||||
}
|
}
|
||||||
case 5: {
|
case 5: {
|
||||||
return "I";
|
return "I";
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
return "F";
|
return "F";
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
return "J";
|
return "J";
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
return "D";
|
return "D";
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
return getClassNameFromType(type.getElementType());
|
return getClassNameFromType(type.getElementType());
|
||||||
}
|
}
|
||||||
case 10: {
|
case 10: {
|
||||||
return "Name";
|
return "Name";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Integer.toString(type.getSort());
|
return Integer.toString(type.getSort());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getArrayTypeByID(int id) {
|
public static String getArrayTypeByID(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 4:
|
case 4:
|
||||||
return "Z";
|
return "Z";
|
||||||
case 5:
|
case 5:
|
||||||
return "C";
|
return "C";
|
||||||
case 6:
|
case 6:
|
||||||
return "F";
|
return "F";
|
||||||
case 7:
|
case 7:
|
||||||
return "D";
|
return "D";
|
||||||
case 8:
|
case 8:
|
||||||
return "B";
|
return "B";
|
||||||
case 9:
|
case 9:
|
||||||
return "S";
|
return "S";
|
||||||
case 10:
|
case 10:
|
||||||
return "I";
|
return "I";
|
||||||
case 11:
|
case 11:
|
||||||
return "J";
|
return "J";
|
||||||
default:
|
default:
|
||||||
return Integer.toString(id);
|
return Integer.toString(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getArrayIDByType(String type) {
|
public static int getArrayIDByType(String type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Z":
|
case "Z":
|
||||||
return 4;
|
return 4;
|
||||||
case "C":
|
case "C":
|
||||||
return 5;
|
return 5;
|
||||||
case "F":
|
case "F":
|
||||||
return 6;
|
return 6;
|
||||||
case "D":
|
case "D":
|
||||||
return 7;
|
return 7;
|
||||||
case "B":
|
case "B":
|
||||||
return 8;
|
return 8;
|
||||||
case "S":
|
case "S":
|
||||||
return 9;
|
return 9;
|
||||||
case "I":
|
case "I":
|
||||||
return 10;
|
return 10;
|
||||||
case "J":
|
case "J":
|
||||||
return 11;
|
return 11;
|
||||||
default:
|
default:
|
||||||
return Integer.parseInt(type);
|
return Integer.parseInt(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getFrameTypeByID(int type) {
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
return "top";
|
||||||
|
case 1:
|
||||||
|
return "int";
|
||||||
|
case 2:
|
||||||
|
return "float";
|
||||||
|
case 3:
|
||||||
|
return "double";
|
||||||
|
case 4:
|
||||||
|
return "long";
|
||||||
|
case 5:
|
||||||
|
return "null";
|
||||||
|
case 6:
|
||||||
|
return "uninitializedThis";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getFrameTypeByName(String type) {
|
||||||
|
switch (type) {
|
||||||
|
case "top":
|
||||||
|
return 0;
|
||||||
|
case "int":
|
||||||
|
return 1;
|
||||||
|
case "float":
|
||||||
|
return 2;
|
||||||
|
case "double":
|
||||||
|
return 3;
|
||||||
|
case "long":
|
||||||
|
return 4;
|
||||||
|
case "null":
|
||||||
|
return 5;
|
||||||
|
case "uninitializedThis":
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getAccessFlagsClass(int access) {
|
public static String getAccessFlagsClass(int access) {
|
||||||
String s = "";
|
String s = "";
|
||||||
if ((ACC_PUBLIC & access) != 0) {
|
if ((ACC_PUBLIC & access) != 0) {
|
||||||
@@ -192,7 +232,8 @@ public class ClassUtil {
|
|||||||
if ((ACC_FINAL & access) != 0) {
|
if ((ACC_FINAL & access) != 0) {
|
||||||
s += "final ";
|
s += "final ";
|
||||||
}
|
}
|
||||||
if ((ACC_ABSTRACT & access) != 0 && (ACC_ANNOTATION & access) == 0 && (ACC_ENUM & access) == 0 && (ACC_INTERFACE & access) == 0) {
|
if ((ACC_ABSTRACT & access) != 0 && (ACC_ANNOTATION & access) == 0 && (ACC_ENUM & access) == 0
|
||||||
|
&& (ACC_INTERFACE & access) == 0) {
|
||||||
s += "abstract ";
|
s += "abstract ";
|
||||||
}
|
}
|
||||||
if ((ACC_SYNTHETIC & access) != 0) {
|
if ((ACC_SYNTHETIC & access) != 0) {
|
||||||
@@ -296,46 +337,46 @@ public class ClassUtil {
|
|||||||
desc = desc.substring(1);
|
desc = desc.substring(1);
|
||||||
}
|
}
|
||||||
switch (desc.substring(0, 1)) {
|
switch (desc.substring(0, 1)) {
|
||||||
case "B":
|
case "B":
|
||||||
type = "byte";
|
type = "byte";
|
||||||
break;
|
break;
|
||||||
case "Z":
|
case "Z":
|
||||||
type = "boolean";
|
type = "boolean";
|
||||||
break;
|
break;
|
||||||
case "I":
|
case "I":
|
||||||
type = "int";
|
type = "int";
|
||||||
break;
|
break;
|
||||||
case "J":
|
case "J":
|
||||||
type = "long";
|
type = "long";
|
||||||
break;
|
break;
|
||||||
case "C":
|
case "C":
|
||||||
type = "char";
|
type = "char";
|
||||||
break;
|
break;
|
||||||
case "D":
|
case "D":
|
||||||
type = "double";
|
type = "double";
|
||||||
break;
|
break;
|
||||||
case "F":
|
case "F":
|
||||||
type = "float";
|
type = "float";
|
||||||
break;
|
break;
|
||||||
case "S":
|
case "S":
|
||||||
type = "short";
|
type = "short";
|
||||||
break;
|
break;
|
||||||
case "V":
|
case "V":
|
||||||
type = "void";
|
type = "void";
|
||||||
break;
|
break;
|
||||||
case "L": {
|
case "L": {
|
||||||
importName = desc.substring(1, desc.length() - 1).replace("/", ".");
|
importName = desc.substring(1, desc.length() - 1).replace("/", ".");
|
||||||
if (!importName.contains(".")) {
|
if (!importName.contains(".")) {
|
||||||
type = importName;
|
type = importName;
|
||||||
importName = null;
|
importName = null;
|
||||||
} else {
|
} else {
|
||||||
type = importName.split("\\.")[importName.split("\\.").length - 1];
|
type = importName.split("\\.")[importName.split("\\.").length - 1];
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
break;
|
||||||
type = "ERROR";
|
}
|
||||||
break;
|
default:
|
||||||
|
type = "ERROR";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < arrSize; i++) {
|
for (int i = 0; i < arrSize; i++) {
|
||||||
type += "[]";
|
type += "[]";
|
||||||
@@ -362,65 +403,65 @@ public class ClassUtil {
|
|||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
}
|
}
|
||||||
switch (parameterType.substring(0, 1)) {
|
switch (parameterType.substring(0, 1)) {
|
||||||
case "B":
|
case "B":
|
||||||
type = "byte";
|
type = "byte";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "Z":
|
case "Z":
|
||||||
type = "boolean";
|
type = "boolean";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "I":
|
case "I":
|
||||||
type = "int";
|
type = "int";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "J":
|
case "J":
|
||||||
type = "long";
|
type = "long";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "C":
|
case "C":
|
||||||
type = "char";
|
type = "char";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "D":
|
case "D":
|
||||||
type = "double";
|
type = "double";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "F":
|
case "F":
|
||||||
type = "float";
|
type = "float";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "S":
|
case "S":
|
||||||
type = "short";
|
type = "short";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "V":
|
case "V":
|
||||||
type = "void";
|
type = "void";
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
break;
|
||||||
case "L": {
|
case "L": {
|
||||||
String rofl = "";
|
String rofl = "";
|
||||||
while (!parameterType.startsWith(";")) {
|
while (!parameterType.startsWith(";")) {
|
||||||
rofl += parameterType.substring(0, 1);
|
|
||||||
parameterType = parameterType.substring(1);
|
|
||||||
}
|
|
||||||
rofl += parameterType.substring(0, 1);
|
rofl += parameterType.substring(0, 1);
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
String importName = rofl.substring(1, rofl.length() - 1).replace("/", ".");
|
|
||||||
if (!importName.contains(".")) {
|
|
||||||
type = importName;
|
|
||||||
importName = null;
|
|
||||||
} else {
|
|
||||||
type = importName.split("\\.")[importName.split("\\.").length - 1];
|
|
||||||
}
|
|
||||||
if (importName != null) {
|
|
||||||
imports.add(importName);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
rofl += parameterType.substring(0, 1);
|
||||||
type = "ERROR";
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
String importName = rofl.substring(1, rofl.length() - 1).replace("/", ".");
|
||||||
|
if (!importName.contains(".")) {
|
||||||
|
type = importName;
|
||||||
|
importName = null;
|
||||||
|
} else {
|
||||||
|
type = importName.split("\\.")[importName.split("\\.").length - 1];
|
||||||
|
}
|
||||||
|
if (importName != null) {
|
||||||
|
imports.add(importName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
type = "ERROR";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < arrSize; i++) {
|
for (int i = 0; i < arrSize; i++) {
|
||||||
type += "[]";
|
type += "[]";
|
||||||
@@ -454,28 +495,28 @@ public class ClassUtil {
|
|||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
}
|
}
|
||||||
switch (parameterType.substring(0, 1)) {
|
switch (parameterType.substring(0, 1)) {
|
||||||
case "B":
|
case "B":
|
||||||
case "Z":
|
case "Z":
|
||||||
case "I":
|
case "I":
|
||||||
case "J":
|
case "J":
|
||||||
case "C":
|
case "C":
|
||||||
case "D":
|
case "D":
|
||||||
case "F":
|
case "F":
|
||||||
case "S":
|
case "S":
|
||||||
case "V":
|
case "V":
|
||||||
|
parameterType = parameterType.substring(1);
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case "L": {
|
||||||
|
while (!parameterType.startsWith(";")) {
|
||||||
parameterType = parameterType.substring(1);
|
parameterType = parameterType.substring(1);
|
||||||
count++;
|
|
||||||
break;
|
|
||||||
case "L": {
|
|
||||||
while (!parameterType.startsWith(";")) {
|
|
||||||
parameterType = parameterType.substring(1);
|
|
||||||
}
|
|
||||||
parameterType = parameterType.substring(1);
|
|
||||||
count++;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
parameterType = parameterType.substring(1);
|
||||||
break;
|
count++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
@@ -483,23 +524,24 @@ public class ClassUtil {
|
|||||||
|
|
||||||
public static String getDecompiledValue(Object o, String desc, boolean escapeSpaces) {
|
public static String getDecompiledValue(Object o, String desc, boolean escapeSpaces) {
|
||||||
switch (o.getClass().getName()) {
|
switch (o.getClass().getName()) {
|
||||||
case "java.lang.String": {
|
case "java.lang.String": {
|
||||||
return "\"" + (escapeSpaces ? UnicodeUtils.escapeWithSpaces((String) o) : UnicodeUtils.escape((String) o)) + "\"";
|
return "\"" + (escapeSpaces ? UnicodeUtils.escapeWithSpaces((String) o) : UnicodeUtils.escape((String) o))
|
||||||
|
+ "\"";
|
||||||
|
}
|
||||||
|
case "java.lang.Integer": {
|
||||||
|
if (desc.equals("Z")) {
|
||||||
|
return ((int) o) == 0 ? "false" : "true";
|
||||||
}
|
}
|
||||||
case "java.lang.Integer": {
|
return o.toString();
|
||||||
if (desc.equals("Z")) {
|
}
|
||||||
return ((int) o) == 0 ? "false" : "true";
|
case "java.lang.Long": {
|
||||||
}
|
return o.toString() + "l";
|
||||||
return o.toString();
|
}
|
||||||
}
|
case "java.lang.Float": {
|
||||||
case "java.lang.Long": {
|
return o.toString() + "f";
|
||||||
return o.toString() + "l";
|
}
|
||||||
}
|
default:
|
||||||
case "java.lang.Float": {
|
return o.toString();
|
||||||
return o.toString() + "f";
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return o.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,32 +551,32 @@ public class ClassUtil {
|
|||||||
|
|
||||||
public static Object getCastedValue(String o, String className) {
|
public static Object getCastedValue(String o, String className) {
|
||||||
switch (className) {
|
switch (className) {
|
||||||
case "java/lang/String": {
|
case "java/lang/String": {
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
case "java/lang/Integer": {
|
case "java/lang/Integer": {
|
||||||
return Integer.parseInt(o);
|
return Integer.parseInt(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Long": {
|
case "java/lang/Long": {
|
||||||
return Long.parseLong(o);
|
return Long.parseLong(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Float": {
|
case "java/lang/Float": {
|
||||||
return Float.parseFloat(o);
|
return Float.parseFloat(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Double": {
|
case "java/lang/Double": {
|
||||||
return Double.parseDouble(o);
|
return Double.parseDouble(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Boolean": {
|
case "java/lang/Boolean": {
|
||||||
return Boolean.parseBoolean(o);
|
return Boolean.parseBoolean(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Short": {
|
case "java/lang/Short": {
|
||||||
return Short.parseShort(o);
|
return Short.parseShort(o);
|
||||||
}
|
}
|
||||||
case "java/lang/Byte": {
|
case "java/lang/Byte": {
|
||||||
return Byte.parseByte(o);
|
return Byte.parseByte(o);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return o.toString();
|
return o.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user