Restore Java 7 Compatibility (#9103)

Summary:
RocksDB should still compile on Java 7.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9103

Reviewed By: pdillinger

Differential Revision: D32067561

Pulled By: mrambacher

fbshipit-source-id: bbe9c18c8007ab3e113de4add56a84c9bde61c8e
main
Adam Retter 3 years ago committed by Facebook GitHub Bot
parent 8ef5b9ddfe
commit be351f4754
  1. 7
      java/src/main/java/org/rocksdb/AbstractMutableOptions.java
  2. 10
      java/src/main/java/org/rocksdb/CompressionType.java

@ -341,11 +341,8 @@ public abstract class AbstractMutableOptions {
return setIntArray(key, value);
case ENUM:
final Optional<CompressionType> compressionType =
CompressionType.getFromInternal(valueStr);
if (compressionType.isPresent()) {
return setEnum(key, compressionType.get());
}
final CompressionType compressionType = CompressionType.getFromInternal(valueStr);
return setEnum(key, compressionType);
}
throw new IllegalStateException(key + " has unknown value type: " + key.getValueType());

@ -5,8 +5,6 @@
package org.rocksdb;
import java.util.Optional;
/**
* Enum CompressionType
*
@ -81,13 +79,15 @@ public enum CompressionType {
*
* @return CompressionType instance (optional)
*/
public static Optional<CompressionType> getFromInternal(final String internalName) {
static CompressionType getFromInternal(final String internalName) {
for (final CompressionType compressionType : CompressionType.values()) {
if (compressionType.internalName_.equals(internalName)) {
return Optional.of(compressionType);
return compressionType;
}
}
return Optional.empty();
throw new IllegalArgumentException(
"Illegal internalName '" + internalName + " ' provided for CompressionType.");
}
/**

Loading…
Cancel
Save