RocksJava must compile on JDK7 (#4768)

Summary:
Fixes some RocksJava regressions recently introduced, whereby RocksJava would not build on JDK 7.
These should have been visible on Travis-CI!
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4768

Differential Revision: D13418173

Pulled By: sagar0

fbshipit-source-id: 57bf223188887f84d9e072031af2e0d2c8a69c30
main
Adam Retter 6 years ago committed by Facebook Github Bot
parent dde3ef1116
commit d3daa0db8b
  1. 8
      java/src/main/java/org/rocksdb/MemoryUsageType.java
  2. 4
      java/src/test/java/org/rocksdb/MergeTest.java

@ -54,9 +54,9 @@ public enum MemoryUsageType {
* cannot be found * cannot be found
*/ */
public static MemoryUsageType getMemoryUsageType(final byte byteIdentifier) { public static MemoryUsageType getMemoryUsageType(final byte byteIdentifier) {
for (final MemoryUsageType MemoryUsageType : MemoryUsageType.values()) { for (final MemoryUsageType memoryUsageType : MemoryUsageType.values()) {
if (MemoryUsageType.getValue() == byteIdentifier) { if (memoryUsageType.getValue() == byteIdentifier) {
return MemoryUsageType; return memoryUsageType;
} }
} }
@ -64,7 +64,7 @@ public enum MemoryUsageType {
"Illegal value provided for MemoryUsageType."); "Illegal value provided for MemoryUsageType.");
} }
private MemoryUsageType(byte value) { MemoryUsageType(byte value) {
value_ = value; value_ = value;
} }

@ -46,13 +46,13 @@ public class MergeTest {
} }
private byte[] longToByteArray(long l) { private byte[] longToByteArray(long l) {
ByteBuffer buf = ByteBuffer.allocate(Long.BYTES); ByteBuffer buf = ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
buf.putLong(l); buf.putLong(l);
return buf.array(); return buf.array();
} }
private long longFromByteArray(byte[] a) { private long longFromByteArray(byte[] a) {
ByteBuffer buf = ByteBuffer.allocate(Long.BYTES); ByteBuffer buf = ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
buf.put(a); buf.put(a);
buf.flip(); buf.flip();
return buf.getLong(); return buf.getLong();

Loading…
Cancel
Save