Skip to content

Commit b92e00c

Browse files
authored
Use SOURCE retention for immutables style annotations (#691)
1 parent 6e69598 commit b92e00c

File tree

12 files changed

+63
-24
lines changed

12 files changed

+63
-24
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* (c) Copyright 2021 Palantir Technologies Inc. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.palantir.tracing.api;
18+
19+
import java.lang.annotation.ElementType;
20+
import java.lang.annotation.Retention;
21+
import java.lang.annotation.RetentionPolicy;
22+
import java.lang.annotation.Target;
23+
import org.immutables.value.Value;
24+
25+
@Target({ElementType.PACKAGE, ElementType.TYPE})
26+
@Retention(RetentionPolicy.SOURCE)
27+
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
28+
@interface ImmutablesStyle {}

tracing-api/src/main/java/com/palantir/tracing/api/OpenSpan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* {@link Span} object.
2727
*/
2828
@Value.Immutable
29-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
29+
@ImmutablesStyle
3030
public abstract class OpenSpan {
3131
private static final Clock CLOCK = Clock.systemUTC();
3232

tracing-api/src/main/java/com/palantir/tracing/api/Span.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/** A value class representing a completed Span, see {@link OpenSpan} for a description of the fields. */
2424
@Value.Immutable
25-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
25+
@ImmutablesStyle
2626
public abstract class Span {
2727

2828
public abstract String getTraceId();

tracing-jaxrs/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ dependencies {
2828
testImplementation "org.assertj:assertj-core"
2929
testImplementation "org.jmock:jmock"
3030
testImplementation "org.mockito:mockito-core"
31-
32-
annotationProcessor "org.immutables:value"
33-
compileOnly "org.immutables:value::annotations"
34-
testCompileOnly "org.immutables:value::annotations"
3531
}

tracing-jersey/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,4 @@ dependencies {
3030
testImplementation "org.assertj:assertj-core"
3131
testImplementation "org.hamcrest:hamcrest-all"
3232
testImplementation "org.mockito:mockito-core"
33-
34-
compileOnly "org.immutables:value::annotations"
35-
testCompileOnly "org.immutables:value::annotations"
3633
}

tracing-okhttp3/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,4 @@ dependencies {
2626
testImplementation "junit:junit"
2727
testImplementation "org.assertj:assertj-core"
2828
testImplementation "org.mockito:mockito-core"
29-
30-
compileOnly "org.immutables:value::annotations"
31-
testCompileOnly "org.immutables:value::annotations"
3229
}

tracing-servlet/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@ dependencies {
2929
testImplementation "io.dropwizard:dropwizard-testing"
3030
testImplementation "junit:junit"
3131
testImplementation 'org.assertj:assertj-core'
32-
33-
compileOnly "org.immutables:value::annotations"
34-
testCompileOnly "org.immutables:value::annotations"
3532
}

tracing-undertow/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,4 @@ dependencies {
3131
testImplementation 'junit:junit'
3232
testImplementation 'org.assertj:assertj-core'
3333
testImplementation 'org.mockito:mockito-core'
34-
35-
compileOnly "org.immutables:value::annotations"
36-
testCompileOnly "org.immutables:value::annotations"
3734
}

tracing/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ dependencies {
4242

4343
annotationProcessor "org.immutables:value"
4444
compileOnly "org.immutables:value::annotations"
45-
testCompileOnly "org.immutables:value::annotations"
4645
}

tracing/src/main/java/com/palantir/tracing/AsyncSlf4jSpanObserver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public final class AsyncSlf4jSpanObserver extends AsyncSpanObserver {
5858

5959
@JsonSerialize(as = ImmutableZipkinCompatSpan.class)
6060
@Value.Immutable
61-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
61+
@ImmutablesStyle
6262
abstract static class ZipkinCompatSpan {
6363

6464
abstract String getTraceId();
@@ -141,7 +141,7 @@ String toJson() {
141141

142142
@JsonSerialize(as = ImmutableZipkinCompatAnnotation.class)
143143
@Value.Immutable
144-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
144+
@ImmutablesStyle
145145
abstract static class ZipkinCompatAnnotation {
146146
abstract long timestamp(); // epoch microseconds
147147

@@ -160,7 +160,7 @@ static ZipkinCompatAnnotation of(long timestamp, String value, ZipkinCompatEndpo
160160

161161
@JsonSerialize(as = ImmutableZipkinCompatBinaryAnnotation.class)
162162
@Value.Immutable
163-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
163+
@ImmutablesStyle
164164
abstract static class ZipkinCompatBinaryAnnotation {
165165

166166
abstract String key();
@@ -180,7 +180,7 @@ static ZipkinCompatBinaryAnnotation of(String key, String value, ZipkinCompatEnd
180180

181181
@JsonSerialize(as = ImmutableZipkinCompatEndpoint.class)
182182
@Value.Immutable
183-
@Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE)
183+
@ImmutablesStyle
184184
@JsonInclude(JsonInclude.Include.NON_NULL)
185185
abstract static class ZipkinCompatEndpoint {
186186
abstract String serviceName();

0 commit comments

Comments
 (0)