Skip to content

Commit

Permalink
Merge pull request facebook#506 from fyrz/RocksJava-Raw-Use
Browse files Browse the repository at this point in the history
[RocksJava] Raw use of parametrized class
  • Loading branch information
adamretter committed Feb 24, 2015
2 parents 30e93c9 + 6a0e737 commit d859939
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion java/src/main/java/org/rocksdb/AbstractComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @see org.rocksdb.Comparator
* @see org.rocksdb.DirectComparator
*/
public abstract class AbstractComparator<T extends AbstractSlice>
public abstract class AbstractComparator<T extends AbstractSlice<?>>
extends RocksObject {

/**
Expand Down
6 changes: 3 additions & 3 deletions java/src/main/java/org/rocksdb/AbstractSlice.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public String toString() {
* 2) == 0 if this == other
* 3) &gt; 0 if this &gt; other
*/
public int compare(final AbstractSlice other) {
public int compare(final AbstractSlice<?> other) {
assert (other != null);
assert (isInitialized());
return compare0(nativeHandle_, other.nativeHandle_);
Expand All @@ -118,7 +118,7 @@ public int compare(final AbstractSlice other) {
@Override
public boolean equals(final Object other) {
if (other != null && other instanceof AbstractSlice) {
return compare((AbstractSlice)other) == 0;
return compare((AbstractSlice<?>)other) == 0;
} else {
return false;
}
Expand All @@ -134,7 +134,7 @@ public boolean equals(final Object other) {
* @return true when this slice starts with the
* {@code prefix} slice
*/
public boolean startsWith(final AbstractSlice prefix) {
public boolean startsWith(final AbstractSlice<?> prefix) {
if (prefix != null) {
assert (isInitialized());
return startsWith0(nativeHandle_, prefix.nativeHandle_);
Expand Down
5 changes: 3 additions & 2 deletions java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public ColumnFamilyOptions setComparator(BuiltinComparator builtinComparator) {
}

@Override
public ColumnFamilyOptions setComparator(AbstractComparator comparator) {
public ColumnFamilyOptions setComparator(
AbstractComparator<? extends AbstractSlice<?>> comparator) {
assert (isInitialized());
setComparatorHandle(nativeHandle_, comparator.nativeHandle_);
comparator_ = comparator;
Expand Down Expand Up @@ -705,5 +706,5 @@ private native void setMinPartialMergeOperands(

MemTableConfig memTableConfig_;
TableFormatConfig tableFormatConfig_;
AbstractComparator comparator_;
AbstractComparator<? extends AbstractSlice<?>> comparator_;
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public interface ColumnFamilyOptionsInterface {
* @param comparator java instance.
* @return the instance of the current Object.
*/
Object setComparator(AbstractComparator comparator);
Object setComparator(AbstractComparator<? extends AbstractSlice<?>> comparator);

/**
* <p>Set the merge operator to be used for merging two merge operands
Expand Down
5 changes: 3 additions & 2 deletions java/src/main/java/org/rocksdb/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public Options setComparator(BuiltinComparator builtinComparator) {
}

@Override
public Options setComparator(AbstractComparator comparator) {
public Options setComparator(
AbstractComparator<? extends AbstractSlice<?>> comparator) {
assert (isInitialized());
setComparatorHandle(nativeHandle_, comparator.nativeHandle_);
comparator_ = comparator;
Expand Down Expand Up @@ -1253,5 +1254,5 @@ private native void setMinPartialMergeOperands(
MemTableConfig memTableConfig_;
TableFormatConfig tableFormatConfig_;
RateLimiterConfig rateLimiterConfig_;
AbstractComparator comparator_;
AbstractComparator<? extends AbstractSlice<?>> comparator_;
}
4 changes: 2 additions & 2 deletions java/src/main/java/org/rocksdb/WriteBatchWithIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public WriteBatchWithIndex(boolean overwriteKey) {
* inserting a duplicate key, in this way an iterator will never
* show two entries with the same key.
*/
public WriteBatchWithIndex(AbstractComparator fallbackIndexComparator, int reservedBytes,
boolean overwriteKey) {
public WriteBatchWithIndex(AbstractComparator<? extends AbstractSlice<?>>
fallbackIndexComparator, int reservedBytes, boolean overwriteKey) {
super();
newWriteBatchWithIndex(fallbackIndexComparator.nativeHandle_, reservedBytes, overwriteKey);
}
Expand Down

0 comments on commit d859939

Please sign in to comment.