Skip to content

Commit

Permalink
Get rid of javax.annotation
Browse files Browse the repository at this point in the history
Rather than a single @nonnull annotation, let's use @NonNullByDefault,
which captures what we want to express here.

Signed-off-by: Robert Varga <[email protected]>
  • Loading branch information
rovarga committed Sep 24, 2018
1 parent d5e355e commit 6cb70ae
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions triemap/src/main/java/tech/pantheon/triemap/Equivalence.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
package tech.pantheon.triemap;

import java.io.Serializable;
import javax.annotation.Nonnull;
import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* Internal equivalence class, similar to com.google.common.base.Equivalence, but explicitly not handling
* nulls. We use equivalence only for keys, which are guaranteed to be non-null.
*
* @author Robert Varga
*/
@NonNullByDefault
abstract class Equivalence<T> implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -67,7 +68,7 @@ static Equivalence<Object> identity() {
return Identity.INSTANCE;
}

final int hash(@Nonnull final T obj) {
final int hash(final T obj) {
int hash = obj.hashCode();

// This function ensures that hashCodes that differ only by
Expand All @@ -78,7 +79,7 @@ final int hash(@Nonnull final T obj) {
return hash;
}

abstract boolean equivalent(@Nonnull T first, @Nonnull T second);
abstract boolean equivalent(T first, T second);

abstract Object readResolve();
}

0 comments on commit 6cb70ae

Please sign in to comment.