aboutsummaryrefslogtreecommitdiff
path: root/impl_core/src/main/java/io/opencensus/implcore
diff options
context:
space:
mode:
authorKristen Kozak <sebright@google.com>2017-12-20 10:46:38 -0800
committerKristen Kozak <sebright@google.com>2017-12-20 10:50:35 -0800
commita2241dd72616869db521cc18724f7beab85be168 (patch)
tree7f4b2ec26cb012a6a631308e024be23f02ab0465 /impl_core/src/main/java/io/opencensus/implcore
parentd579d8f12b8a76bfb55c538b71d5f014885eb1e0 (diff)
downloadopencensus-java-a2241dd72616869db521cc18724f7beab85be168.tar.gz
Rename NullnessUtils to CheckerFrameworkUtils.
Diffstat (limited to 'impl_core/src/main/java/io/opencensus/implcore')
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/internal/CheckerFrameworkUtils.java (renamed from impl_core/src/main/java/io/opencensus/implcore/internal/NullnessUtils.java)4
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/stats/MutableAggregation.java13
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java15
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/trace/SpanImpl.java8
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/trace/internal/ConcurrentIntrusiveList.java8
5 files changed, 27 insertions, 21 deletions
diff --git a/impl_core/src/main/java/io/opencensus/implcore/internal/NullnessUtils.java b/impl_core/src/main/java/io/opencensus/implcore/internal/CheckerFrameworkUtils.java
index 3d2d4d15..4d5f9c4d 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/internal/NullnessUtils.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/internal/CheckerFrameworkUtils.java
@@ -26,8 +26,8 @@ import org.checkerframework.checker.nullness.qual.KeyForBottom;
/**
* Utility methods for suppressing nullness warnings and working around Checker Framework issues.
*/
-public final class NullnessUtils {
- private NullnessUtils() {}
+public final class CheckerFrameworkUtils {
+ private CheckerFrameworkUtils() {}
/** Suppress warnings about a nullable value. */
// TODO(sebright): Try to remove all uses of this method.
diff --git a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableAggregation.java b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableAggregation.java
index 1a5771eb..49124b00 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableAggregation.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableAggregation.java
@@ -20,7 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import io.opencensus.common.Function;
-import io.opencensus.implcore.internal.NullnessUtils;
+import io.opencensus.implcore.internal.CheckerFrameworkUtils;
import io.opencensus.stats.Aggregation;
import io.opencensus.stats.BucketBoundaries;
@@ -100,7 +100,8 @@ abstract class MutableAggregation {
Function<? super MutableCount, T> p1,
Function<? super MutableMean, T> p2,
Function<? super MutableDistribution, T> p3) {
- return NullnessUtils.<MutableSum, T>removeSuperFromFunctionParameterType(p0).apply(this);
+ return CheckerFrameworkUtils.<MutableSum, T>removeSuperFromFunctionParameterType(p0)
+ .apply(this);
}
}
@@ -146,7 +147,8 @@ abstract class MutableAggregation {
Function<? super MutableCount, T> p1,
Function<? super MutableMean, T> p2,
Function<? super MutableDistribution, T> p3) {
- return NullnessUtils.<MutableCount, T>removeSuperFromFunctionParameterType(p1).apply(this);
+ return CheckerFrameworkUtils.<MutableCount, T>removeSuperFromFunctionParameterType(p1)
+ .apply(this);
}
}
@@ -214,7 +216,8 @@ abstract class MutableAggregation {
Function<? super MutableCount, T> p1,
Function<? super MutableMean, T> p2,
Function<? super MutableDistribution, T> p3) {
- return NullnessUtils.<MutableMean, T>removeSuperFromFunctionParameterType(p2).apply(this);
+ return CheckerFrameworkUtils.<MutableMean, T>removeSuperFromFunctionParameterType(p2)
+ .apply(this);
}
}
@@ -356,7 +359,7 @@ abstract class MutableAggregation {
Function<? super MutableCount, T> p1,
Function<? super MutableMean, T> p2,
Function<? super MutableDistribution, T> p3) {
- return NullnessUtils.<MutableDistribution, T>removeSuperFromFunctionParameterType(p3)
+ return CheckerFrameworkUtils.<MutableDistribution, T>removeSuperFromFunctionParameterType(p3)
.apply(this);
}
}
diff --git a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
index 4963ce59..8ecb7dca 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
@@ -26,7 +26,7 @@ import io.opencensus.common.Duration;
import io.opencensus.common.Function;
import io.opencensus.common.Functions;
import io.opencensus.common.Timestamp;
-import io.opencensus.implcore.internal.NullnessUtils;
+import io.opencensus.implcore.internal.CheckerFrameworkUtils;
import io.opencensus.implcore.stats.MutableAggregation.MutableCount;
import io.opencensus.implcore.stats.MutableAggregation.MutableDistribution;
import io.opencensus.implcore.stats.MutableAggregation.MutableMean;
@@ -313,7 +313,7 @@ abstract class MutableViewData {
getTagValues(getTagMap(context), super.view.getColumns());
refreshBucketList(timestamp);
// It is always the last bucket that does the recording.
- NullnessUtils.castNonNull(buckets.peekLast()).record(tagValues, value);
+ CheckerFrameworkUtils.castNonNull(buckets.peekLast()).record(tagValues, value);
}
@Override
@@ -351,7 +351,8 @@ abstract class MutableViewData {
if (buckets.size() != N + 1) {
throw new AssertionError("Bucket list must have exactly " + (N + 1) + " buckets.");
}
- Timestamp startOfLastBucket = NullnessUtils.castNonNull(buckets.peekLast()).getStart();
+ Timestamp startOfLastBucket =
+ CheckerFrameworkUtils.castNonNull(buckets.peekLast()).getStart();
// TODO(songya): decide what to do when time goes backwards
checkArgument(
now.compareTo(startOfLastBucket) >= 0,
@@ -368,7 +369,9 @@ abstract class MutableViewData {
if (!buckets.isEmpty()) {
startOfNewBucket =
- NullnessUtils.castNonNull(buckets.peekLast()).getStart().addDuration(bucketDuration);
+ CheckerFrameworkUtils.castNonNull(buckets.peekLast())
+ .getStart()
+ .addDuration(bucketDuration);
} else {
// Initialize bucket list. Should only enter this block once.
startOfNewBucket = subtractDuration(now, totalDuration);
@@ -418,8 +421,8 @@ abstract class MutableViewData {
Aggregation aggregation,
Timestamp now) {
// Put fractional stats of the head (oldest) bucket.
- IntervalBucket head = NullnessUtils.castNonNull(buckets.peekFirst());
- IntervalBucket tail = NullnessUtils.castNonNull(buckets.peekLast());
+ IntervalBucket head = CheckerFrameworkUtils.castNonNull(buckets.peekFirst());
+ IntervalBucket tail = CheckerFrameworkUtils.castNonNull(buckets.peekLast());
double fractionTail = tail.getFraction(now);
// TODO(songya): decide what to do when time goes backwards
checkArgument(
diff --git a/impl_core/src/main/java/io/opencensus/implcore/trace/SpanImpl.java b/impl_core/src/main/java/io/opencensus/implcore/trace/SpanImpl.java
index f80ba2bf..8ce863e7 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/trace/SpanImpl.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/trace/SpanImpl.java
@@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkState;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.EvictingQueue;
import io.opencensus.common.Clock;
-import io.opencensus.implcore.internal.NullnessUtils;
+import io.opencensus.implcore.internal.CheckerFrameworkUtils;
import io.opencensus.implcore.internal.TimestampConverter;
import io.opencensus.implcore.trace.internal.ConcurrentIntrusiveList.Element;
import io.opencensus.trace.Annotation;
@@ -250,7 +250,7 @@ public final class SpanImpl extends Span implements Element<SpanImpl> {
parentSpanId,
hasRemoteParent,
name,
- NullnessUtils.castNonNull(timestampConverter).convertNanoTime(startNanoTime),
+ CheckerFrameworkUtils.castNonNull(timestampConverter).convertNanoTime(startNanoTime),
attributesSpanData,
annotationsSpanData,
networkEventsSpanData,
@@ -258,7 +258,7 @@ public final class SpanImpl extends Span implements Element<SpanImpl> {
null, // Not supported yet.
hasBeenEnded ? getStatusWithDefault() : null,
hasBeenEnded
- ? NullnessUtils.castNonNull(timestampConverter).convertNanoTime(endNanoTime)
+ ? CheckerFrameworkUtils.castNonNull(timestampConverter).convertNanoTime(endNanoTime)
: null);
}
}
@@ -439,7 +439,7 @@ public final class SpanImpl extends Span implements Element<SpanImpl> {
List<TimedEvent<T>> eventsList = new ArrayList<TimedEvent<T>>(events.events.size());
for (EventWithNanoTime<T> networkEvent : events.events) {
eventsList.add(
- networkEvent.toSpanDataTimedEvent(NullnessUtils.castNonNull(timestampConverter)));
+ networkEvent.toSpanDataTimedEvent(CheckerFrameworkUtils.castNonNull(timestampConverter)));
}
return SpanData.TimedEvents.create(eventsList, events.getNumberOfDroppedEvents());
}
diff --git a/impl_core/src/main/java/io/opencensus/implcore/trace/internal/ConcurrentIntrusiveList.java b/impl_core/src/main/java/io/opencensus/implcore/trace/internal/ConcurrentIntrusiveList.java
index 5b131756..22d8e41a 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/trace/internal/ConcurrentIntrusiveList.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/trace/internal/ConcurrentIntrusiveList.java
@@ -18,7 +18,7 @@ package io.opencensus.implcore.trace.internal;
import static com.google.common.base.Preconditions.checkArgument;
-import io.opencensus.implcore.internal.NullnessUtils;
+import io.opencensus.implcore.internal.CheckerFrameworkUtils;
import io.opencensus.implcore.trace.internal.ConcurrentIntrusiveList.Element;
import java.util.ArrayList;
import java.util.Collection;
@@ -108,11 +108,11 @@ public final class ConcurrentIntrusiveList<T extends Element<T>> {
} else if (element.getNext() == null) {
// This is the last element, and there is at least another element because
// element.getPrev() != null.
- NullnessUtils.castNonNull(element.getPrev()).setNext(null);
+ CheckerFrameworkUtils.castNonNull(element.getPrev()).setNext(null);
element.setPrev(null);
} else {
- NullnessUtils.castNonNull(element.getPrev()).setNext(element.getNext());
- NullnessUtils.castNonNull(element.getNext()).setPrev(element.getPrev());
+ CheckerFrameworkUtils.castNonNull(element.getPrev()).setNext(element.getNext());
+ CheckerFrameworkUtils.castNonNull(element.getNext()).setPrev(element.getPrev());
element.setNext(null);
element.setPrev(null);
}