Skip to content

Commit

Permalink
simplify BytecodeVersionTest.verifyMagic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Apr 12, 2023
1 parent cdfb090 commit 0b61bb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

import org.junit.jupiter.api.Test;

Expand All @@ -30,11 +29,9 @@ public void verifyJava8() throws IOException {
}

private void verifyMagic(DataInputStream stream) throws IOException {
byte[] buf = new byte[4];

stream.readFully(buf);
if (buf[0] != (byte) 0xCA || buf[1] != (byte) 0xFE || buf[2] != (byte) 0xBA || buf[3] != (byte) 0xBE) {
fail("Invalid magic value: " + Arrays.toString(buf));
int magic = stream.readInt();
if (magic != 0xCA_FE_BA_BE) {
fail("Invalid magic value: " + Integer.toHexString(magic));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

import org.junit.jupiter.api.Test;

Expand All @@ -30,11 +29,9 @@ public void verifyJava8() throws IOException {
}

private void verifyMagic(DataInputStream stream) throws IOException {
byte[] buf = new byte[4];

stream.readFully(buf);
if (buf[0] != (byte) 0xCA || buf[1] != (byte) 0xFE || buf[2] != (byte) 0xBA || buf[3] != (byte) 0xBE) {
fail("Invalid magic value: " + Arrays.toString(buf));
int magic = stream.readInt();
if (magic != 0xCA_FE_BA_BE) {
fail("Invalid magic value: " + Integer.toHexString(magic));
}
}

Expand Down

0 comments on commit 0b61bb7

Please sign in to comment.