diff --git a/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java b/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java index 4b042c02eb29..381d66a6ec06 100644 --- a/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java +++ b/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java @@ -7,7 +7,6 @@ import static java.util.logging.Level.FINE; import static java.util.logging.Level.SEVERE; -import static java.util.logging.Level.WARNING; import com.google.errorprone.annotations.CanIgnoreReturnValue; import io.opentelemetry.instrumentation.api.internal.cache.Cache; @@ -118,6 +117,7 @@ public HelperInjector( List helpers = helperClassNames.stream() + .distinct() .map( className -> HelperClassDefinition.create( @@ -184,11 +184,8 @@ public DynamicType.Builder transform( HelperClassDefinition::getClassName, helper -> () -> helper.getBytecode().getBytecode(), (a, b) -> { - logger.log( - WARNING, - "Duplicate classname for helper class in module {0} detected", - new Object[] {this.requestingName}); - return a; + throw new IllegalStateException( + "Duplicate classnames for helper class detected!"); }, LinkedHashMap::new)); diff --git a/testing-common/integration-tests/src/main/java/helper/DuplicateHelper.java b/testing-common/integration-tests/src/main/java/helper/DuplicateHelper.java index 920d5b309ced..258e6bac73fd 100644 --- a/testing-common/integration-tests/src/main/java/helper/DuplicateHelper.java +++ b/testing-common/integration-tests/src/main/java/helper/DuplicateHelper.java @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package helper; public class DuplicateHelper { diff --git a/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentation.java b/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentation.java index 478b0399ce02..4d6be67a1f9c 100644 --- a/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentation.java +++ b/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentation.java @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package helper; import static net.bytebuddy.matcher.ElementMatchers.named; diff --git a/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentationModule.java b/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentationModule.java index 898acb496068..4b31e4fecc18 100644 --- a/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentationModule.java +++ b/testing-common/integration-tests/src/main/java/helper/DuplicateHelperInstrumentationModule.java @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package helper; import static java.util.Collections.singletonList; diff --git a/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTest.java b/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTest.java index 4b5dd877f0cb..b0aed068d476 100644 --- a/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTest.java +++ b/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTest.java @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package helper; import static org.assertj.core.api.Assertions.assertThat; diff --git a/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTestClass.java b/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTestClass.java index 447029a4b7a9..6efbec4b0d22 100644 --- a/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTestClass.java +++ b/testing-common/integration-tests/src/test/java/helper/DuplicateHelperTestClass.java @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package helper; class DuplicateHelperTestClass {