Repository navigation
Instruction audit: Use exact compatibility method-handle lookups and declaring-class loaders - #21584
Open
otelbot[bot] wants to merge 1 commit into
Open
otelbot[bot] wants to merge 1 commit into
otelbot[bot] wants to merge 1 commit into
Conversation
Pull request dashboard statusWaiting on reviewers · refreshed 2026-11-28 15:26 UTC Review the latest changes. Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The current MethodHandles.lookup() call can impose incompatible RequestPath class-loader constraints, causing LinkageError and breaking application startup in mixed Spring parent/child-loader setups.
1 open issue
What changed in this PR
Updates compatibility helpers across instrumentation modules to reduce unrelated class resolution and improve behavior with mixed library versions and class loaders.
Changes:
- Replaces reflective discovery with exact method-handle lookups for known signatures.
- Resolves optional signature types through declaring-class loaders without initialization.
- Applies loader-aware resolution to shared Spring test helpers.
| File | Description |
|---|---|
| OpenTelemetryHandlerMappingFilter.java | Uses exact lookup for Spring MVC path parsing. |
| AbstractSpringWebfluxClientInstrumentationTest.java | Loads status types through the client response loader. |
| WebfluxServerHttpAttributesGetter.java | Uses the server response loader for status lookup. |
| StatusCodes.java | Uses the client response loader for status lookup. |
| AbstractSpringKafkaTest.java | Resolves the legacy future type through Kafka operations. |
| ServerCallAccess.java | Resolves server-call alternatives through the request loader. |
| ConfigServerTargetUtil30.java | Tries exact address-getter signatures for supported return types. |
| ChatCompletionEventsHelper.java | Uses declaring-class loaders for tool-call signature types. |
| KafkaUtil.java | Loads consumer-group metadata through the consumer loader. |
| MetroServerSpanNameUpdater.java | Uses exact lookups for servlet path accessors. |
| CouchbaseQueryText.java | Resolves the statement type through the query loader. |
| RequestAccess.java | Uses the target class loader for Lambda configuration lookup. |
| RegistryCapturingClusterWrapper.java | Uses exact lookups for both Dubbo cluster-join signatures. |
Review effort: Balanced
| Class.forName("org.springframework.http.server.RequestPath", false, classLoader); | ||
| Class<?> servletRequestClass = | ||
| Class.forName("javax.servlet.http.HttpServletRequest", false, classLoader); | ||
| return MethodHandles.lookup() |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR fixes a finding from an instruction audit run that checked the following repository rule:
Explanation
Replace broad reflective lookup for known compatibility methods with exact method-handle lookup, and resolve optional signature types through their declaring types without initializing them. This avoids resolution of unrelated member dependencies and incompatible signature classes in mixed-loader applications. Existing version alternatives, optional-method fallbacks, and invocation behavior are retained.