Skip to content

Commit 648c15c

Browse files
committed
spotless
1 parent 9f610f9 commit 648c15c

File tree

8 files changed

+462
-423
lines changed

8 files changed

+462
-423
lines changed

internal-api/src/main/java/datadog/trace/api/TagMap.java

Lines changed: 319 additions & 330 deletions
Large diffs are not rendered by default.

internal-api/src/test/java/datadog/trace/api/TagMapBucketGroupTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public void _replace() {
8282
int origHash = origEntry.hash();
8383
int otherHash = otherEntry.hash();
8484

85-
OptimizedTagMap.BucketGroup group = new OptimizedTagMap.BucketGroup(origHash, origEntry, otherHash, otherEntry);
85+
OptimizedTagMap.BucketGroup group =
86+
new OptimizedTagMap.BucketGroup(origHash, origEntry, otherHash, otherEntry);
8687
assertContainsDirectly(origEntry, group);
8788
assertContainsDirectly(otherEntry, group);
8889

@@ -150,7 +151,8 @@ public void groupChaining() {
150151
assertFalse(firstGroup._insert(newHash, newEntry));
151152
assertDoesntContainDirectly(newEntry, firstGroup);
152153

153-
OptimizedTagMap.BucketGroup newHeadGroup = new OptimizedTagMap.BucketGroup(newHash, newEntry, firstGroup);
154+
OptimizedTagMap.BucketGroup newHeadGroup =
155+
new OptimizedTagMap.BucketGroup(newHash, newEntry, firstGroup);
154156
assertContainsDirectly(newEntry, newHeadGroup);
155157
assertSame(firstGroup, newHeadGroup.prev);
156158

@@ -302,7 +304,8 @@ static final OptimizedTagMap.BucketGroup fullGroup(int startingIndex) {
302304
TagMap.Entry.newObjectEntry(tag(startingIndex + 1), value(startingIndex + 1));
303305

304306
OptimizedTagMap.BucketGroup group =
305-
new OptimizedTagMap.BucketGroup(firstEntry.hash(), firstEntry, secondEntry.hash(), secondEntry);
307+
new OptimizedTagMap.BucketGroup(
308+
firstEntry.hash(), firstEntry, secondEntry.hash(), secondEntry);
306309
for (int offset = 2; offset < OptimizedTagMap.BucketGroup.LEN; ++offset) {
307310
TagMap.Entry anotherEntry =
308311
TagMap.Entry.newObjectEntry(tag(startingIndex + offset), value(startingIndex + offset));
@@ -311,7 +314,8 @@ static final OptimizedTagMap.BucketGroup fullGroup(int startingIndex) {
311314
return group;
312315
}
313316

314-
static final OptimizedTagMap.BucketGroup fullGroup(int startingIndex, OptimizedTagMap.BucketGroup prev) {
317+
static final OptimizedTagMap.BucketGroup fullGroup(
318+
int startingIndex, OptimizedTagMap.BucketGroup prev) {
315319
OptimizedTagMap.BucketGroup group = fullGroup(startingIndex);
316320
group.prev = prev;
317321
return group;

internal-api/src/test/java/datadog/trace/api/TagMapEntryTest.java

Lines changed: 80 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.junit.jupiter.api.Assertions.assertFalse;
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7+
import datadog.trace.api.TagMap.Entry;
78
import java.util.ArrayList;
89
import java.util.Collections;
910
import java.util.List;
@@ -15,13 +16,10 @@
1516
import java.util.concurrent.ThreadFactory;
1617
import java.util.function.Function;
1718
import java.util.function.Supplier;
18-
1919
import org.junit.Test;
2020
import org.junit.jupiter.params.ParameterizedTest;
2121
import org.junit.jupiter.params.provider.ValueSource;
2222

23-
import datadog.trace.api.TagMap.Entry;
24-
2523
/**
2624
* Since TagMap.Entry is thread safe and has involves complicated multi-thread type resolution code,
2725
* this test uses a different approach to stress ordering different combinations.
@@ -62,34 +60,35 @@ public void anyEntry_object() {
6260
}
6361

6462
@ParameterizedTest
65-
@ValueSource(booleans={false, true})
63+
@ValueSource(booleans = {false, true})
6664
public void booleanEntry(boolean value) {
6765
test(
68-
() -> TagMap.Entry.newBooleanEntry("foo", value),
69-
TagMap.Entry.BOOLEAN,
70-
(entry) ->
71-
multiCheck(
72-
checkKey("foo", entry),
73-
checkValue(value, entry),
74-
checkFalse(entry::isNumericPrimitive),
75-
checkType(TagMap.Entry.BOOLEAN, entry)));
66+
() -> TagMap.Entry.newBooleanEntry("foo", value),
67+
TagMap.Entry.BOOLEAN,
68+
(entry) ->
69+
multiCheck(
70+
checkKey("foo", entry),
71+
checkValue(value, entry),
72+
checkFalse(entry::isNumericPrimitive),
73+
checkType(TagMap.Entry.BOOLEAN, entry)));
7674
}
7775

7876
@ParameterizedTest
79-
@ValueSource(booleans= {false, true})
77+
@ValueSource(booleans = {false, true})
8078
public void booleanEntry_boxed(boolean value) {
8179
test(
82-
() -> TagMap.Entry.newBooleanEntry("foo", Boolean.valueOf(value)),
83-
TagMap.Entry.BOOLEAN,
84-
(entry) -> multiCheck(
85-
checkKey("foo", entry),
86-
checkValue(value, entry),
87-
checkFalse(entry::isNumericPrimitive),
88-
checkType(TagMap.Entry.BOOLEAN, entry)));
80+
() -> TagMap.Entry.newBooleanEntry("foo", Boolean.valueOf(value)),
81+
TagMap.Entry.BOOLEAN,
82+
(entry) ->
83+
multiCheck(
84+
checkKey("foo", entry),
85+
checkValue(value, entry),
86+
checkFalse(entry::isNumericPrimitive),
87+
checkType(TagMap.Entry.BOOLEAN, entry)));
8988
}
9089

9190
@ParameterizedTest
92-
@ValueSource(booleans= {false, true})
91+
@ValueSource(booleans = {false, true})
9392
public void anyEntry_boolean(boolean value) {
9493
test(
9594
() -> TagMap.Entry.newAnyEntry("foo", Boolean.valueOf(value)),
@@ -104,7 +103,7 @@ public void anyEntry_boolean(boolean value) {
104103
}
105104

106105
@ParameterizedTest
107-
@ValueSource(ints= {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
106+
@ValueSource(ints = {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
108107
public void intEntry(int value) {
109108
test(
110109
() -> TagMap.Entry.newIntEntry("foo", value),
@@ -118,7 +117,7 @@ public void intEntry(int value) {
118117
}
119118

120119
@ParameterizedTest
121-
@ValueSource(ints= {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
120+
@ValueSource(ints = {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
122121
public void intEntry_boxed(int value) {
123122
test(
124123
() -> TagMap.Entry.newIntEntry("foo", Integer.valueOf(value)),
@@ -132,7 +131,7 @@ public void intEntry_boxed(int value) {
132131
}
133132

134133
@ParameterizedTest
135-
@ValueSource(ints= {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
134+
@ValueSource(ints = {Integer.MIN_VALUE, -256, -128, -1, 0, 1, 128, 256, Integer.MAX_VALUE})
136135
public void anyEntry_int(int value) {
137136
test(
138137
() -> TagMap.Entry.newAnyEntry("foo", Integer.valueOf(value)),
@@ -147,7 +146,22 @@ public void anyEntry_int(int value) {
147146
}
148147

149148
@ParameterizedTest
150-
@ValueSource(longs= {Long.MIN_VALUE, Integer.MIN_VALUE, -1_048_576L, -256L, -128L, -1L, 0L, 1L, 128L, 256L, 1_048_576L, Integer.MAX_VALUE, Long.MAX_VALUE})
149+
@ValueSource(
150+
longs = {
151+
Long.MIN_VALUE,
152+
Integer.MIN_VALUE,
153+
-1_048_576L,
154+
-256L,
155+
-128L,
156+
-1L,
157+
0L,
158+
1L,
159+
128L,
160+
256L,
161+
1_048_576L,
162+
Integer.MAX_VALUE,
163+
Long.MAX_VALUE
164+
})
151165
public void longEntry(long value) {
152166
test(
153167
() -> TagMap.Entry.newLongEntry("foo", value),
@@ -161,7 +175,22 @@ public void longEntry(long value) {
161175
}
162176

163177
@ParameterizedTest
164-
@ValueSource(longs= {Long.MIN_VALUE, Integer.MIN_VALUE, -1_048_576L, -256L, -128L, -1L, 0L, 1L, 128L, 256L, 1_048_576L, Integer.MAX_VALUE, Long.MAX_VALUE})
178+
@ValueSource(
179+
longs = {
180+
Long.MIN_VALUE,
181+
Integer.MIN_VALUE,
182+
-1_048_576L,
183+
-256L,
184+
-128L,
185+
-1L,
186+
0L,
187+
1L,
188+
128L,
189+
256L,
190+
1_048_576L,
191+
Integer.MAX_VALUE,
192+
Long.MAX_VALUE
193+
})
165194
public void longEntry_boxed(long value) {
166195
test(
167196
() -> TagMap.Entry.newLongEntry("foo", Long.valueOf(value)),
@@ -175,7 +204,22 @@ public void longEntry_boxed(long value) {
175204
}
176205

177206
@ParameterizedTest
178-
@ValueSource(longs= {Long.MIN_VALUE, Integer.MIN_VALUE, -1_048_576L, -256L, -128L, -1L, 0L, 1L, 128L, 256L, 1_048_576L, Integer.MAX_VALUE, Long.MAX_VALUE})
207+
@ValueSource(
208+
longs = {
209+
Long.MIN_VALUE,
210+
Integer.MIN_VALUE,
211+
-1_048_576L,
212+
-256L,
213+
-128L,
214+
-1L,
215+
0L,
216+
1L,
217+
128L,
218+
256L,
219+
1_048_576L,
220+
Integer.MAX_VALUE,
221+
Long.MAX_VALUE
222+
})
179223
public void anyEntry_long(long value) {
180224
test(
181225
() -> TagMap.Entry.newAnyEntry("foo", Long.valueOf(value)),
@@ -190,7 +234,7 @@ public void anyEntry_long(long value) {
190234
}
191235

192236
@ParameterizedTest
193-
@ValueSource(floats= {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
237+
@ValueSource(floats = {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
194238
public void floatEntry(float value) {
195239
test(
196240
() -> TagMap.Entry.newFloatEntry("foo", value),
@@ -204,7 +248,7 @@ public void floatEntry(float value) {
204248
}
205249

206250
@ParameterizedTest
207-
@ValueSource(floats= {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
251+
@ValueSource(floats = {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
208252
public void floatEntry_boxed(float value) {
209253
test(
210254
() -> TagMap.Entry.newFloatEntry("foo", Float.valueOf(value)),
@@ -218,7 +262,7 @@ public void floatEntry_boxed(float value) {
218262
}
219263

220264
@ParameterizedTest
221-
@ValueSource(floats= {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
265+
@ValueSource(floats = {Float.MIN_VALUE, -1F, 0F, 1F, 2.171828F, 3.1415F, Float.MAX_VALUE})
222266
public void anyEntry_float(float value) {
223267
test(
224268
() -> TagMap.Entry.newAnyEntry("foo", Float.valueOf(value)),
@@ -232,7 +276,8 @@ public void anyEntry_float(float value) {
232276
}
233277

234278
@ParameterizedTest
235-
@ValueSource(doubles= {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
279+
@ValueSource(
280+
doubles = {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
236281
public void doubleEntry(double value) {
237282
test(
238283
() -> TagMap.Entry.newDoubleEntry("foo", value),
@@ -246,7 +291,8 @@ public void doubleEntry(double value) {
246291
}
247292

248293
@ParameterizedTest
249-
@ValueSource(doubles= {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
294+
@ValueSource(
295+
doubles = {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
250296
public void doubleEntry_boxed(double value) {
251297
test(
252298
() -> TagMap.Entry.newDoubleEntry("foo", Double.valueOf(value)),
@@ -260,7 +306,8 @@ public void doubleEntry_boxed(double value) {
260306
}
261307

262308
@ParameterizedTest
263-
@ValueSource(doubles= {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
309+
@ValueSource(
310+
doubles = {Double.MIN_VALUE, Float.MIN_VALUE, -1D, 0D, 1D, Math.E, Math.PI, Double.MAX_VALUE})
264311
public void anyEntry_double(double value) {
265312
test(
266313
() -> TagMap.Entry.newAnyEntry("foo", Double.valueOf(value)),

internal-api/src/test/java/datadog/trace/api/TagMapFuzzTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ static final void assertMapEquals(Map<String, Object> expected, OptimizedTagMap
996996
Object expectedValue = expected.get(actualEntry.tag());
997997
assertEquals(expectedValue, actualEntry.objectValue());
998998
}
999-
999+
10001000
actual.checkIntegrity();
10011001
}
10021002

@@ -1052,7 +1052,7 @@ static final TagMap tagMapOf(String... keysAndValues) {
10521052
map.set(key, value);
10531053
}
10541054
map.checkIntegrity();
1055-
1055+
10561056
return map;
10571057
}
10581058

internal-api/src/test/java/datadog/trace/api/TagMapLedgerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void buildMutable() {
7373
// just proving that the map is mutable
7474
map.set(key(1000), value(1000));
7575
}
76-
76+
7777
@ParameterizedTest
7878
@EnumSource(TagMapType.class)
7979
public void buildMutable(TagMapType mapType) {
@@ -111,7 +111,7 @@ public void buildImmutable() {
111111

112112
assertFrozen(map);
113113
}
114-
114+
115115
@ParameterizedTest
116116
@EnumSource(TagMapType.class)
117117
public void buildImmutable(TagMapType mapType) {
@@ -145,7 +145,7 @@ public void build_empty(TagMapType mapType) {
145145
assertTrue(ledger.isDefinitelyEmpty());
146146
assertNotSame(mapType.empty(), ledger.build(mapType.factory));
147147
}
148-
148+
149149
@Test
150150
public void buildImmutable_empty() {
151151
TagMap.Ledger ledger = TagMap.ledger();

0 commit comments

Comments
 (0)