Polishing
This commit is contained in:
parent
ea534b6820
commit
214fa9c2a0
|
@ -362,7 +362,7 @@ public class CodeFlow implements Opcodes {
|
||||||
// nop
|
// nop
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("cannot get from "+stackTop+" to "+targetDescriptor);
|
throw new IllegalStateException("Cannot get from " + stackTop + " to " + targetDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (stackTop == 'J') {
|
else if (stackTop == 'J') {
|
||||||
|
@ -379,7 +379,7 @@ public class CodeFlow implements Opcodes {
|
||||||
mv.visitInsn(L2I);
|
mv.visitInsn(L2I);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("cannot get from "+stackTop+" to "+targetDescriptor);
|
throw new IllegalStateException("Cannot get from " + stackTop + " to " + targetDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (stackTop == 'F') {
|
else if (stackTop == 'F') {
|
||||||
|
@ -396,7 +396,7 @@ public class CodeFlow implements Opcodes {
|
||||||
mv.visitInsn(F2I);
|
mv.visitInsn(F2I);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("cannot get from "+stackTop+" to "+targetDescriptor);
|
throw new IllegalStateException("Cannot get from " + stackTop + " to " + targetDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (stackTop == 'D') {
|
else if (stackTop == 'D') {
|
||||||
|
@ -413,7 +413,7 @@ public class CodeFlow implements Opcodes {
|
||||||
mv.visitInsn(D2I);
|
mv.visitInsn(D2I);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("cannot get from "+stackDescriptor+" to "+targetDescriptor);
|
throw new IllegalStateException("Cannot get from " + stackDescriptor + " to " + targetDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the descriptor is for a boolean primitive or boolean reference type.
|
* Determine whether the descriptor is for a boolean primitive or boolean reference type.
|
||||||
* @param descriptor type descriptor
|
* @param descriptor type descriptor
|
||||||
* @return {@code true} if the descriptor is boolean compatible
|
* @return {@code true} if the descriptor is boolean compatible
|
||||||
*/
|
*/
|
||||||
|
@ -539,7 +539,7 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the descriptor is for a primitive type.
|
* Determine whether the descriptor is for a primitive type.
|
||||||
* @param descriptor type descriptor
|
* @param descriptor type descriptor
|
||||||
* @return {@code true} if a primitive type
|
* @return {@code true} if a primitive type
|
||||||
*/
|
*/
|
||||||
|
@ -548,7 +548,7 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the descriptor is for a primitive array (e.g. "[[I").
|
* Determine whether the descriptor is for a primitive array (e.g. "[[I").
|
||||||
* @param descriptor the descriptor for a possible primitive array
|
* @param descriptor the descriptor for a possible primitive array
|
||||||
* @return {@code true} if the descriptor a primitive array
|
* @return {@code true} if the descriptor a primitive array
|
||||||
*/
|
*/
|
||||||
|
@ -569,8 +569,8 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if boxing/unboxing can get from one type to the other. Assumes at least
|
* Determine whether boxing/unboxing can get from one type to the other.
|
||||||
* one of the types is in boxed form (i.e. single char descriptor).
|
* Assumes at least one of the types is in boxed form (i.e. single char descriptor).
|
||||||
* @return {@code true} if it is possible to get (via boxing) from one descriptor to the other
|
* @return {@code true} if it is possible to get (via boxing) from one descriptor to the other
|
||||||
*/
|
*/
|
||||||
public static boolean areBoxingCompatible(String desc1, String desc2) {
|
public static boolean areBoxingCompatible(String desc1, String desc2) {
|
||||||
|
@ -781,9 +781,8 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deduce the descriptor for a type. Descriptors are like JVM type names but missing
|
* Deduce the descriptor for a type. Descriptors are like JVM type names but missing the
|
||||||
* the trailing ';' so for Object the descriptor is "Ljava/lang/Object" for int it is
|
* trailing ';' so for Object the descriptor is "Ljava/lang/Object" for int it is "I".
|
||||||
* "I".
|
|
||||||
* @param type the type (may be primitive) for which to determine the descriptor
|
* @param type the type (may be primitive) for which to determine the descriptor
|
||||||
* @return the descriptor
|
* @return the descriptor
|
||||||
*/
|
*/
|
||||||
|
@ -971,7 +970,7 @@ public class CodeFlow implements Opcodes {
|
||||||
if (ch == '[') {
|
if (ch == '[') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return ch=='L';
|
return (ch == 'L');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -991,8 +990,8 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (arraytype.charAt(0) == '[') {
|
if (arraytype.charAt(0) == '[') {
|
||||||
// Handling the nested array case here. If vararg
|
// Handling the nested array case here.
|
||||||
// is [[I then we want [I and not [I;
|
// If vararg is [[I then we want [I and not [I;
|
||||||
if (CodeFlow.isReferenceTypeArray(arraytype)) {
|
if (CodeFlow.isReferenceTypeArray(arraytype)) {
|
||||||
mv.visitTypeInsn(ANEWARRAY, arraytype + ";");
|
mv.visitTypeInsn(ANEWARRAY, arraytype + ";");
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1025,7 @@ public class CodeFlow implements Opcodes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String toBoxedDescriptor(String primitiveDescriptor) {
|
public static String toBoxedDescriptor(String primitiveDescriptor) {
|
||||||
switch (primitiveDescriptor.charAt(0)) {
|
switch (primitiveDescriptor.charAt(0)) {
|
||||||
case 'I': return "Ljava/lang/Integer";
|
case 'I': return "Ljava/lang/Integer";
|
||||||
case 'J': return "Ljava/lang/Long";
|
case 'J': return "Ljava/lang/Long";
|
||||||
|
|
Loading…
Reference in New Issue