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
This commit is contained in:
Adam Retter 2021-11-08 08:19:54 -08:00 committed by sdong
parent 7c25388623
commit 52626f10b1
2 changed files with 7 additions and 10 deletions

View File

@ -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());

View File

@ -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.");
}
/**