Skip to content

Commit

Permalink
Make Advice proper immutable class
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Jun 13, 2023
1 parent ac0b4e4 commit 0bed21f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package io.opentelemetry.sdk.metrics.internal.descriptor;

import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
Expand All @@ -21,6 +23,10 @@ public static Advice empty() {
}

public static Advice create(@Nullable List<Double> explicitBucketBoundaries) {
if (explicitBucketBoundaries != null) {
explicitBucketBoundaries =
Collections.unmodifiableList(new ArrayList<>(explicitBucketBoundaries));
}
return new AutoValue_Advice(explicitBucketBoundaries);
}

Expand Down

0 comments on commit 0bed21f

Please sign in to comment.