Minor RocksJava Java code cosmetics (#9204)

Summary:
Specifically:
- unused imports
- code formatting
- typos in comments
- unnecessary casts
- missing default label in switch statement
- explicit use of long literals in multiplication
- use generics where possible without backward compatibility risk

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

Reviewed By: ajkr

Differential Revision: D32955184

Pulled By: jay-zhuang

fbshipit-source-id: 42d05ce42639d982b9ea34c8081266dfba7f1efa
main
stefan-zobel 3 years ago committed by Facebook GitHub Bot
parent aec95b8c09
commit f57745814f
  1. 3
      java/src/main/java/org/rocksdb/AbstractMutableOptions.java
  2. 7
      java/src/main/java/org/rocksdb/CompactRangeOptions.java
  3. 10
      java/src/main/java/org/rocksdb/MutableColumnFamilyOptionsInterface.java
  4. 1
      java/src/main/java/org/rocksdb/OptionsUtil.java
  5. 4
      java/src/main/java/org/rocksdb/RocksDB.java
  6. 3
      java/src/main/java/org/rocksdb/SanityLevel.java
  7. 2
      java/src/main/java/org/rocksdb/TraceOptions.java
  8. 1
      java/src/main/java/org/rocksdb/TransactionDB.java
  9. 5
      java/src/main/java/org/rocksdb/TransactionalDB.java
  10. 1
      java/src/main/java/org/rocksdb/util/Environment.java

@ -343,10 +343,11 @@ public abstract class AbstractMutableOptions {
case ENUM:
final CompressionType compressionType = CompressionType.getFromInternal(valueStr);
return setEnum(key, compressionType);
}
default:
throw new IllegalStateException(key + " has unknown value type: " + key.getValueType());
}
}
/**
*

@ -15,13 +15,14 @@ public class CompactRangeOptions extends RocksObject {
private final static byte VALUE_kIfHaveCompactionFilter = 1;
private final static byte VALUE_kForce = 2;
// For level based compaction, we can configure if we want to skip/force bottommost level compaction.
// The order of this neum MUST follow the C++ layer. See BottommostLevelCompaction in db/options.h
// For level based compaction, we can configure if we want to skip/force bottommost level
// compaction. The order of this enum MUST follow the C++ layer. See BottommostLevelCompaction in
// db/options.h
public enum BottommostLevelCompaction {
/**
* Skip bottommost level compaction
*/
kSkip((byte)VALUE_kSkip),
kSkip(VALUE_kSkip),
/**
* Only compact bottommost level if there is a compaction filter. This is the default option
*/

@ -26,7 +26,7 @@ public interface MutableColumnFamilyOptionsInterface<
* @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* while overflowing the underlying platform specific value.
*/
MutableColumnFamilyOptionsInterface setWriteBufferSize(long writeBufferSize);
T setWriteBufferSize(long writeBufferSize);
/**
* Return size of write buffer size.
@ -43,8 +43,7 @@ public interface MutableColumnFamilyOptionsInterface<
* @param disableAutoCompactions true if auto-compactions are disabled.
* @return the reference to the current option.
*/
MutableColumnFamilyOptionsInterface setDisableAutoCompactions(
boolean disableAutoCompactions);
T setDisableAutoCompactions(boolean disableAutoCompactions);
/**
* Disable automatic compactions. Manual compactions can still
@ -64,8 +63,7 @@ public interface MutableColumnFamilyOptionsInterface<
* level-0 compaction
* @return the reference to the current option.
*/
MutableColumnFamilyOptionsInterface setLevel0FileNumCompactionTrigger(
int level0FileNumCompactionTrigger);
T setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger);
/**
* Number of files to trigger level-0 compaction. A value &lt; 0 means that
@ -86,7 +84,7 @@ public interface MutableColumnFamilyOptionsInterface<
* @return the reference to the current option.
* @see #maxCompactionBytes()
*/
MutableColumnFamilyOptionsInterface setMaxCompactionBytes(final long maxCompactionBytes);
T setMaxCompactionBytes(final long maxCompactionBytes);
/**
* We try to limit number of bytes in one compaction to be lower than this

@ -5,7 +5,6 @@
package org.rocksdb;
import java.util.ArrayList;
import java.util.List;
public class OptionsUtil {

@ -4651,7 +4651,7 @@ public class RocksDB extends RocksObject {
return rangeSliceHandles;
}
protected void storeOptionsInstance(DBOptionsInterface options) {
protected void storeOptionsInstance(DBOptionsInterface<?> options) {
options_ = options;
}
@ -4974,7 +4974,7 @@ public class RocksDB extends RocksObject {
private native static int version();
protected DBOptionsInterface options_;
protected DBOptionsInterface<?> options_;
private static Version version;
public static class Version {

@ -16,8 +16,7 @@ public enum SanityLevel {
*
* @return the internal representation value.
*/
// TODO(AR) should be made package-private
public byte getValue() {
byte getValue() {
return value;
}

@ -13,7 +13,7 @@ public class TraceOptions {
private final long maxTraceFileSize;
public TraceOptions() {
this.maxTraceFileSize = 64L * 1024 * 1024 * 1024; // 64 GB
this.maxTraceFileSize = 64L * 1024L * 1024L * 1024L; // 64 GB
}
public TraceOptions(final long maxTraceFileSize) {

@ -6,7 +6,6 @@
package org.rocksdb;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ -5,10 +5,7 @@
package org.rocksdb;
interface TransactionalDB<T extends TransactionalOptions>
extends AutoCloseable {
interface TransactionalDB<T extends TransactionalOptions<T>> extends AutoCloseable {
/**
* Starts a new Transaction.
*

@ -1,7 +1,6 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
package org.rocksdb.util;
import java.io.File;
import java.io.IOException;
public class Environment {

Loading…
Cancel
Save