Skip to content

Commit 576ef17

Browse files
spotless fixes for test cases
1 parent 3b19c67 commit 576ef17

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import static java.util.logging.Level.FINE;
99
import static java.util.logging.Level.SEVERE;
10-
import static java.util.logging.Level.WARNING;
1110

1211
import com.google.errorprone.annotations.CanIgnoreReturnValue;
1312
import io.opentelemetry.instrumentation.api.internal.cache.Cache;
@@ -118,6 +117,7 @@ public HelperInjector(
118117

119118
List<HelperClassDefinition> helpers =
120119
helperClassNames.stream()
120+
.distinct()
121121
.map(
122122
className ->
123123
HelperClassDefinition.create(
@@ -184,11 +184,8 @@ public DynamicType.Builder<?> transform(
184184
HelperClassDefinition::getClassName,
185185
helper -> () -> helper.getBytecode().getBytecode(),
186186
(a, b) -> {
187-
logger.log(
188-
WARNING,
189-
"Duplicate classname for helper class in module {0} detected",
190-
new Object[] {this.requestingName});
191-
return a;
187+
throw new IllegalStateException(
188+
"Duplicate classnames for helper class detected!");
192189
},
193190
LinkedHashMap::new));
194191

testing-common/integration-tests/src/main/java/helper/DuplicateHelper.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package helper;
27

38
public class DuplicateHelper {

testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentation.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package helper;
27

38
import static net.bytebuddy.matcher.ElementMatchers.named;

testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentationModule.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package helper;
27

38
import static java.util.Collections.singletonList;

testing-common/integration-tests/src/test/java/helper/DuplicateHelperTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package helper;
27

38
import static org.assertj.core.api.Assertions.assertThat;

testing-common/integration-tests/src/test/java/helper/DuplicateHelperTestClass.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package helper;
27

38
class DuplicateHelperTestClass {

0 commit comments

Comments
 (0)