Example:
// Main.java
public class Main {
public static void main(String[] args) {
int[] ints = { 0x01020304, 0x05060708 };
byte[] bytes = Test.castToByteArray(ints);
System.out.println(bytes[0] + " " + bytes[1]);
}
}
// Test.jasm
super class Test
version 52:0
{
public Method "<init>":"()V"
stack 1 locals 1
{
aload_0;
invokespecial Method java/lang/Object."<init>":"()V";
return;
}
public static Method castToByteArray:"([I)[B"
stack 1 locals 1
{
aload_0;
areturn;
}
} // end Class Test
Expected Output (Windows, x64):
4 3
// Main.java
public class Main {
public static void main(String[] args) {
int[] ints = { 0x01020304, 0x05060708 };
byte[] bytes = Test.castToByteArray(ints);
System.out.println(bytes[0] + " " + bytes[1]);
}
}
// Test.jasm
super class Test
version 52:0
{
public Method "<init>":"()V"
stack 1 locals 1
{
aload_0;
invokespecial Method java/lang/Object."<init>":"()V";
return;
}
public static Method castToByteArray:"([I)[B"
stack 1 locals 1
{
aload_0;
areturn;
}
} // end Class Test
Expected Output (Windows, x64):
4 3
- relates to
-
JDK-8131725 4.10.1.2: Clarify array types in verification type system
-
- Closed
-