Update bytebuddy core dependency, and make dependencies more dependabot friendly
(probably need to revisit later what's a "core dependency" and what's
not, but doesn't seem to be any real difference other than organization)
MODIFY
dependencyManagement/build.gradle.kts
dependencyManagement/build.gradle.kts
@@ -40,43 +40,29 @@ val DEPENDENCY_BOMS = listOf(
"org.testcontainers:testcontainers-bom:1.17.3",
)
-val DEPENDENCY_SETS = listOf(
- DependencySet(
- "com.google.auto.service",
- "1.0.1",
- listOf("auto-service", "auto-service-annotations")
- ),
- DependencySet(
- "com.google.auto.value",
- "1.9",
- listOf("auto-value", "auto-value-annotations")
- ),
- DependencySet(
- "com.google.errorprone",
- "2.14.0",
- listOf("error_prone_annotations", "error_prone_core", "error_prone_test_helpers")
- ),
- DependencySet(
- "net.bytebuddy",
+val CORE_DEPENDENCIES = listOf(
+ "com.google.auto.service:auto-service:1.0.1",
+ "com.google.auto.service:auto-service-annotations:1.0.1",
+ "com.google.auto.value:auto-value:1.9",
+ "com.google.auto.value:auto-value-annotations:1.9",
+ "com.google.errorprone:error_prone_annotations:2.14.0",
+ "com.google.errorprone:error_prone_core:2.14.0",
+ "com.google.errorprone:error_prone_test_helpers:2.14.0",
// When updating, also update conventions/build.gradle.kts
- "1.12.10",
- listOf("byte-buddy", "byte-buddy-dep", "byte-buddy-agent", "byte-buddy-gradle-plugin")
- ),
- DependencySet(
- "org.openjdk.jmh",
- "1.35",
- listOf("jmh-core", "jmh-generator-bytecode")
- ),
- DependencySet(
- "org.mockito",
- "4.7.0",
- listOf("mockito-core", "mockito-junit-jupiter", "mockito-inline")
- ),
- DependencySet(
- "org.slf4j",
- "1.7.36",
- listOf("slf4j-api", "slf4j-simple", "log4j-over-slf4j", "jcl-over-slf4j", "jul-to-slf4j")
- ),
+ "net.bytebuddy:byte-buddy:1.12.17",
+ "net.bytebuddy:byte-buddy-dep:1.12.17",
+ "net.bytebuddy:byte-buddy-agent:1.12.17",
+ "net.bytebuddy:byte-buddy-gradle-plugin:1.12.17",
+ "org.openjdk.jmh:jmh-core:1.35",
+ "org.openjdk.jmh:jmh-generator-bytecode:1.35",
+ "org.mockito:mockito-core:4.7.0",
+ "org.mockito:mockito-junit-jupiter:4.7.0",
+ "org.mockito:mockito-inline:4.7.0",
+ "org.slf4j:slf4j-api:1.7.36",
+ "org.slf4j:slf4j-simple:1.7.36",
+ "org.slf4j:log4j-over-slf4j:1.7.36",
+ "org.slf4j:jcl-over-slf4j:1.7.36",
+ "org.slf4j:jul-to-slf4j:1.7.36"
)
// See the comment above about why we keep this rather large list.
@@ -130,11 +116,10 @@ dependencies {
dependencyVersions[split[0]] = split[2]
}
constraints {
- for (set in DEPENDENCY_SETS) {
- for (module in set.modules) {
- api("${set.group}:${module}:${set.version}")
- dependencyVersions[set.group] = set.version
- }
+ for (dependency in CORE_DEPENDENCIES) {
+ api(dependency)
+ val split = dependency.split(':')
+ dependencyVersions[split[0]] = split[2]
}
for (dependency in DEPENDENCIES) {
api(dependency)

MODIFY
instrumentation/internal/internal-lambda/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/lambda/InnerClassLambdaMetafactoryInstrumentation.java
instrumentation/internal/internal-lambda/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/lambda/InnerClassLambdaMetafactoryInstrumentation.java
@@ -33,7 +33,7 @@ public class InnerClassLambdaMetafactoryInstrumentation implements TypeInstrumen
@Override
public void transform(TypeTransformer transformer) {
transformer.applyTransformer(
- (builder, typeDescription, classLoader, module) ->
+ (builder, typeDescription, classLoader, javaModule, protectionDomain) ->
builder.visit(
new AsmVisitorWrapper() {
@Override

MODIFY
instrumentation/internal/internal-reflection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/reflection/ClassInstrumentation.java
instrumentation/internal/internal-reflection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/internal/reflection/ClassInstrumentation.java
@@ -32,7 +32,7 @@ public class ClassInstrumentation implements TypeInstrumentation {
@Override
public void transform(TypeTransformer transformer) {
transformer.applyTransformer(
- (builder, typeDescription, classLoader, module) ->
+ (builder, typeDescription, classLoader, javaModule, protectionDomain) ->
builder.visit(
new AsmVisitorWrapper() {
@Override

MODIFY
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/client/RmiClientContextInstrumentation.java
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/client/RmiClientContextInstrumentation.java
@@ -66,15 +66,15 @@ public class RmiClientContextInstrumentation implements TypeInstrumentation {
// expose sun.rmi.transport.StreamRemoteCall to helper classes
transformer.applyTransformer(
- (builder, typeDescription, classLoader, module) -> {
+ (builder, typeDescription, classLoader, javaModule, protectionDomain) -> {
if (JavaModule.isSupported()
&& classLoader == null
&& "sun.rmi.transport.StreamRemoteCall".equals(typeDescription.getName())
- && module != null) {
+ && javaModule != null) {
Instrumentation instrumentation = InstrumentationHolder.getInstrumentation();
ClassInjector.UsingInstrumentation.redefineModule(
instrumentation,
- module,
+ javaModule,
Collections.emptySet(),
Collections.emptyMap(),
Collections.singletonMap(

MODIFY
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/jpms/ExposeRmiModuleInstrumentation.java
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/context/jpms/ExposeRmiModuleInstrumentation.java
@@ -55,15 +55,15 @@ public class ExposeRmiModuleInstrumentation implements TypeInstrumentation {
@Override
public void transform(TypeTransformer transformer) {
transformer.applyTransformer(
- (builder, typeDescription, classLoader, module) -> {
- if (module != null && module.isNamed()) {
+ (builder, typeDescription, classLoader, javaModule, protectionDomain) -> {
+ if (javaModule != null && javaModule.isNamed()) {
// using Java8BytecodeBridge because it's in the unnamed module in the bootstrap
// loader, and that's where the rmi instrumentation helper classes will end up
JavaModule helperModule = JavaModule.ofType(Java8BytecodeBridge.class);
// expose sun.rmi.server package to unnamed module
ClassInjector.UsingInstrumentation.redefineModule(
InstrumentationHolder.getInstrumentation(),
- module,
+ javaModule,
Collections.emptySet(),
Collections.singletonMap("sun.rmi.server", Collections.singleton(helperModule)),
Collections.emptyMap(),
@@ -72,7 +72,9 @@ public class ExposeRmiModuleInstrumentation implements TypeInstrumentation {
instrumented.set(true);
logger.log(
- FINE, "Exposed package \"sun.rmi.server\" in module {0} to unnamed module", module);
+ FINE,
+ "Exposed package \"sun.rmi.server\" in module {0} to unnamed module",
+ javaModule);
}
return builder;
});

MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/field/FieldBackedImplementationInstaller.java
@@ -21,6 +21,7 @@ import io.opentelemetry.javaagent.tooling.muzzle.VirtualFieldMappings;
import io.opentelemetry.javaagent.tooling.util.IgnoreFailedTypeMatcher;
import io.opentelemetry.javaagent.tooling.util.NamedMatcher;
import java.lang.instrument.Instrumentation;
+import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
@@ -145,13 +146,15 @@ final class FieldBackedImplementationInstaller implements VirtualFieldImplementa
DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassLoader classLoader,
- JavaModule module) {
+ JavaModule javaModule,
+ ProtectionDomain protectionDomain) {
return injector.transform(
builder,
typeDescription,
// virtual field implementation classes will always go to the bootstrap
null,
- module);
+ javaModule,
+ protectionDomain);
}
};
}
@@ -244,7 +247,8 @@ final class FieldBackedImplementationInstaller implements VirtualFieldImplementa
}
private static AgentBuilder.Transformer getTransformerForAsmVisitor(AsmVisitorWrapper visitor) {
- return (builder, typeDescription, classLoader, module) -> builder.visit(visitor);
+ return (builder, typeDescription, classLoader, javaModule, protectionDomain) ->
+ builder.visit(visitor);
}
// Originally found in AgentBuilder.Transformer.NoOp, but removed in 1.10.7
@@ -256,7 +260,8 @@ final class FieldBackedImplementationInstaller implements VirtualFieldImplementa
DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassLoader classLoader,
- JavaModule module) {
+ JavaModule javaModule,
+ ProtectionDomain protectionDomain) {
return builder;
}
}

MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/ConstantAdjuster.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/instrumentation/ConstantAdjuster.java
package io.opentelemetry.javaagent.tooling.instrumentation;
+import java.security.ProtectionDomain;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.asm.TypeConstantAdjustment;
import net.bytebuddy.description.type.TypeDescription;
@@ -31,7 +32,8 @@ final class ConstantAdjuster implements AgentBuilder.Transformer {
DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassLoader classLoader,
- JavaModule module) {
+ JavaModule javaModule,
+ ProtectionDomain protectionDomain) {
return builder.visit(TypeConstantAdjustment.INSTANCE);
}
}

MODIFY
javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/test/HelperInjectionTest.groovy
javaagent-tooling/src/test/groovy/io/opentelemetry/javaagent/test/HelperInjectionTest.groovy
@@ -39,7 +39,7 @@ class HelperInjectionTest extends Specification {
thrown ClassNotFoundException
when:
- injector.transform(null, null, emptyLoader.get(), null)
+ injector.transform(null, null, emptyLoader.get(), null, null)
HelperInjector.loadHelperClass(emptyLoader.get(), helperClassName)
emptyLoader.get().loadClass(helperClassName)
then:
@@ -73,7 +73,7 @@ class HelperInjectionTest extends Specification {
when:
def bootstrapClassloader = null
- injector.transform(null, null, bootstrapClassloader, null)
+ injector.transform(null, null, bootstrapClassloader, null, null)
Class<?> helperClass = bootstrapChild.loadClass(helperClassName)
then:
helperClass.getClassLoader() == bootstrapClassloader

RENAME
licenses/byte-buddy-dep-1.12.10.jar/META-INF/LICENSE
licenses/byte-buddy-dep-1.12.17.jar/META-INF/LICENSE
RENAME
licenses/byte-buddy-dep-1.12.10.jar/META-INF/NOTICE
licenses/byte-buddy-dep-1.12.17.jar/META-INF/NOTICE
MODIFY
licenses/licenses.md
licenses/licenses.md
#javaagent
##Dependency License Report
-_2022-09-18 15:10:09 PDT_
+_2022-09-21 18:58:30 PDT_
## Apache License, Version 2.0
**1** **Group:** `com.blogspot.mydailyjava` **Name:** `weak-lock-free` **Version:** `0.18`
@@ -155,10 +155,10 @@ _2022-09-18 15:10:09 PDT_
> - **POM License**: Apache License, Version 2.0 - [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
> - **Embedded license files**: [zipkin-2.23.2.jar/META-INF/LICENSE](zipkin-2.23.2.jar/META-INF/LICENSE)
-**35** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.12.10`
+**35** **Group:** `net.bytebuddy` **Name:** `byte-buddy-dep` **Version:** `1.12.17`
> - **POM License**: Apache License, Version 2.0 - [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
-> - **Embedded license files**: [byte-buddy-dep-1.12.10.jar/META-INF/LICENSE](byte-buddy-dep-1.12.10.jar/META-INF/LICENSE)
- - [byte-buddy-dep-1.12.10.jar/META-INF/NOTICE](byte-buddy-dep-1.12.10.jar/META-INF/NOTICE)
+> - **Embedded license files**: [byte-buddy-dep-1.12.17.jar/META-INF/LICENSE](byte-buddy-dep-1.12.17.jar/META-INF/LICENSE)
+ - [byte-buddy-dep-1.12.17.jar/META-INF/NOTICE](byte-buddy-dep-1.12.17.jar/META-INF/NOTICE)
**36** **Group:** `org.jetbrains` **Name:** `annotations` **Version:** `13.0`
> - **POM Project URL**: [http://www.jetbrains.org](http://www.jetbrains.org)

MODIFY
muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java
muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java
@@ -17,6 +17,7 @@ import java.io.IOException;
import java.lang.instrument.Instrumentation;
import java.net.URL;
import java.nio.file.Files;
+import java.security.ProtectionDomain;
import java.security.SecureClassLoader;
import java.util.Collection;
import java.util.Collections;
@@ -167,7 +168,8 @@ public class HelperInjector implements Transformer {
DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassLoader classLoader,
- JavaModule module) {
+ JavaModule javaModule,
+ ProtectionDomain protectionDomain) {
if (!helperClassNames.isEmpty()) {
injectHelperClasses(typeDescription, classLoader);
}

MODIFY
muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/ClassLoaderMatcher.java
muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/ClassLoaderMatcher.java
@@ -93,7 +93,7 @@ public class ClassLoaderMatcher {
helperResourceBuilder.getResources(),
Thread.currentThread().getContextClassLoader(),
null)
- .transform(null, null, classLoader, null);
+ .transform(null, null, classLoader, null, null);
}
} catch (RuntimeException e) {
mismatches = ReferenceMatcher.add(mismatches, new Mismatch.HelperClassesInjectionError());

Update bytebuddy core dependency, and make dependencies more dependabot friendly (#6704)

(probably need to revisit later what's a "core dependency" and what's
not, but doesn't seem to be any real difference other than organization)