2727import java .util .List ;
2828import java .util .Map ;
2929import java .util .Map .Entry ;
30+ import javax .annotation .Nullable ;
3031import javax .annotation .concurrent .Immutable ;
3132
32- /*>>>
33- import org.checkerframework.checker.nullness.qual.Nullable;
34- */
35-
3633/**
3734 * {@link Resource} represents a resource, which capture identifying information about the entities
3835 * for which signals (stats or traces) are reported. It further provides a framework for detection
@@ -57,7 +54,7 @@ public abstract class Resource {
5754 private static final String ERROR_MESSAGE_INVALID_VALUE =
5855 " should be a ASCII string with a length not exceed " + MAX_LENGTH + " characters." ;
5956
60- @ javax . annotation . Nullable
57+ @ Nullable
6158 private static final String ENV_TYPE = parseResourceType (System .getenv (OC_RESOURCE_TYPE_ENV ));
6259
6360 private static final Map <String , String > ENV_LABEL_MAP =
@@ -71,7 +68,7 @@ public abstract class Resource {
7168 * @return the type identifier for the resource.
7269 * @since 0.18
7370 */
74- @ javax . annotation . Nullable
71+ @ Nullable
7572 public abstract String getType ();
7673
7774 /**
@@ -104,8 +101,7 @@ public static Resource createFromEnvironmentVariables() {
104101 * ASCII string or exceed {@link #MAX_LENGTH} characters.
105102 * @since 0.18
106103 */
107- public static Resource create (
108- @ javax .annotation .Nullable String type , Map <String , String > labels ) {
104+ public static Resource create (@ Nullable String type , Map <String , String > labels ) {
109105 return createInternal (
110106 type ,
111107 Collections .unmodifiableMap (
@@ -120,7 +116,7 @@ public static Resource create(
120116 * @return a {@code Resource}.
121117 * @since 0.18
122118 */
123- @ javax . annotation . Nullable
119+ @ Nullable
124120 public static Resource mergeResources (List <Resource > resources ) {
125121 Resource currentResource = null ;
126122 for (Resource resource : resources ) {
@@ -129,8 +125,7 @@ public static Resource mergeResources(List<Resource> resources) {
129125 return currentResource ;
130126 }
131127
132- private static Resource createInternal (
133- @ javax .annotation .Nullable String type , Map <String , String > labels ) {
128+ private static Resource createInternal (@ Nullable String type , Map <String , String > labels ) {
134129 return new AutoValue_Resource (type , labels );
135130 }
136131
@@ -140,8 +135,8 @@ private static Resource createInternal(
140135 * <p>OC_RESOURCE_TYPE: A string that describes the type of the resource prefixed by a domain
141136 * namespace, e.g. “kubernetes.io/container”.
142137 */
143- @ javax . annotation . Nullable
144- static String parseResourceType (@ javax . annotation . Nullable String rawEnvType ) {
138+ @ Nullable
139+ static String parseResourceType (@ Nullable String rawEnvType ) {
145140 if (rawEnvType != null && !rawEnvType .isEmpty ()) {
146141 Utils .checkArgument (isValidAndNotEmpty (rawEnvType ), "Type" + ERROR_MESSAGE_INVALID_CHARS );
147142 return rawEnvType .trim ();
@@ -157,7 +152,7 @@ static String parseResourceType(@javax.annotation.Nullable String rawEnvType) {
157152 * quoted or unquoted in general. If a value contains whitespaces, =, or " characters, it must
158153 * always be quoted.
159154 */
160- static Map <String , String > parseResourceLabels (@ javax . annotation . Nullable String rawEnvLabels ) {
155+ static Map <String , String > parseResourceLabels (@ Nullable String rawEnvLabels ) {
161156 if (rawEnvLabels == null ) {
162157 return Collections .<String , String >emptyMap ();
163158 } else {
@@ -182,10 +177,8 @@ static Map<String, String> parseResourceLabels(@javax.annotation.Nullable String
182177 * Returns a new, merged {@link Resource} by merging two resources. In case of a collision, first
183178 * resource takes precedence.
184179 */
185- @ javax .annotation .Nullable
186- private static Resource merge (
187- @ javax .annotation .Nullable Resource resource ,
188- @ javax .annotation .Nullable Resource otherResource ) {
180+ @ Nullable
181+ private static Resource merge (@ Nullable Resource resource , @ Nullable Resource otherResource ) {
189182 if (otherResource == null ) {
190183 return resource ;
191184 }
0 commit comments