diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java index c13b5681c8e..8a13a96f4ed 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java @@ -115,7 +115,7 @@ public class StandardMessageCodec implements MessageCodec { * Writes an int representing a size to the specified stream. Uses an expanding code of 1 to 5 * bytes to optimize for small values. */ - protected static final void writeSize(@NonNull ByteArrayOutputStream stream, int value) { + protected static void writeSize(@NonNull ByteArrayOutputStream stream, int value) { if (BuildConfig.DEBUG && 0 > value) { Log.e(TAG, "Attempted to write a negative size."); } @@ -131,7 +131,7 @@ public class StandardMessageCodec implements MessageCodec { } /** Writes the least significant two bytes of the specified int to the specified stream. */ - protected static final void writeChar(@NonNull ByteArrayOutputStream stream, int value) { + protected static void writeChar(@NonNull ByteArrayOutputStream stream, int value) { if (LITTLE_ENDIAN) { stream.write(value); stream.write(value >>> 8); @@ -142,7 +142,7 @@ public class StandardMessageCodec implements MessageCodec { } /** Writes the specified int as 4 bytes to the specified stream. */ - protected static final void writeInt(@NonNull ByteArrayOutputStream stream, int value) { + protected static void writeInt(@NonNull ByteArrayOutputStream stream, int value) { if (LITTLE_ENDIAN) { stream.write(value); stream.write(value >>> 8); @@ -157,7 +157,7 @@ public class StandardMessageCodec implements MessageCodec { } /** Writes the specified long as 8 bytes to the specified stream. */ - protected static final void writeLong(@NonNull ByteArrayOutputStream stream, long value) { + protected static void writeLong(@NonNull ByteArrayOutputStream stream, long value) { if (LITTLE_ENDIAN) { stream.write((byte) value); stream.write((byte) (value >>> 8)); @@ -180,18 +180,17 @@ public class StandardMessageCodec implements MessageCodec { } /** Writes the specified double as 4 bytes to the specified stream */ - protected static final void writeFloat(@NonNull ByteArrayOutputStream stream, float value) { + protected static void writeFloat(@NonNull ByteArrayOutputStream stream, float value) { writeInt(stream, Float.floatToIntBits(value)); } /** Writes the specified double as 8 bytes to the specified stream. */ - protected static final void writeDouble(@NonNull ByteArrayOutputStream stream, double value) { + protected static void writeDouble(@NonNull ByteArrayOutputStream stream, double value) { writeLong(stream, Double.doubleToLongBits(value)); } /** Writes the length and then the actual bytes of the specified array to the specified stream. */ - protected static final void writeBytes( - @NonNull ByteArrayOutputStream stream, @NonNull byte[] bytes) { + protected static void writeBytes(@NonNull ByteArrayOutputStream stream, @NonNull byte[] bytes) { writeSize(stream, bytes.length); stream.write(bytes, 0, bytes.length); } @@ -201,7 +200,7 @@ public class StandardMessageCodec implements MessageCodec { * aligned to a whole multiple of the specified alignment. An example usage with alignment = 8 is * to ensure doubles are word-aligned in the stream. */ - protected static final void writeAlignment(@NonNull ByteArrayOutputStream stream, int alignment) { + protected static void writeAlignment(@NonNull ByteArrayOutputStream stream, int alignment) { final int mod = stream.size() % alignment; if (mod != 0) { for (int i = 0; i < alignment - mod; i++) { @@ -221,7 +220,7 @@ public class StandardMessageCodec implements MessageCodec { if (value == null || value.equals(null)) { stream.write(NULL); } else if (value instanceof Boolean) { - stream.write(((Boolean) value).booleanValue() ? TRUE : FALSE); + stream.write((Boolean) value ? TRUE : FALSE); } else if (value instanceof Number) { if (value instanceof Integer || value instanceof Short || value instanceof Byte) { stream.write(INT); @@ -299,7 +298,7 @@ public class StandardMessageCodec implements MessageCodec { } /** Reads an int representing a size as written by writeSize. */ - protected static final int readSize(@NonNull ByteBuffer buffer) { + protected static int readSize(@NonNull ByteBuffer buffer) { if (!buffer.hasRemaining()) { throw new IllegalArgumentException("Message corrupted"); } @@ -315,7 +314,7 @@ public class StandardMessageCodec implements MessageCodec { /** Reads a byte array as written by writeBytes. */ @NonNull - protected static final byte[] readBytes(@NonNull ByteBuffer buffer) { + protected static byte[] readBytes(@NonNull ByteBuffer buffer) { final int length = readSize(buffer); final byte[] bytes = new byte[length]; buffer.get(bytes); @@ -323,7 +322,7 @@ public class StandardMessageCodec implements MessageCodec { } /** Reads alignment padding bytes as written by writeAlignment. */ - protected static final void readAlignment(@NonNull ByteBuffer buffer, int alignment) { + protected static void readAlignment(@NonNull ByteBuffer buffer, int alignment) { final int mod = buffer.position() % alignment; if (mod != 0) { buffer.position(buffer.position() + alignment - mod);