Skip to content

Conversation

trask
Copy link
Member

@trask trask commented Aug 21, 2025

The generic type makes it awkward to use with @AutoService, because it requires you to use SuppressWarnings("rawtypes") (some background at google/auto#870), e.g.

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/c7dd76454f5af080a1c385fdb7fda2c6bace68f5/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/internal/ProcessResourceComponentProvider.java#L19-L20

Plus, it doesn't seem like we lose much by removing the generic type (in fact it ends up being slightly less code).

@trask trask force-pushed the remove-component-provider-generic-type branch 4 times, most recently from 696ddc4 to 03ea864 Compare August 21, 2025 23:55
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.99%. Comparing base (4c0044e) to head (c172389).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7606      +/-   ##
============================================
- Coverage     89.99%   89.99%   -0.01%     
+ Complexity     7079     7078       -1     
============================================
  Files           803      803              
  Lines         21419    21410       -9     
  Branches       2086     2086              
============================================
- Hits          19276    19267       -9     
  Misses         1479     1479              
  Partials        664      664              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trask trask force-pushed the remove-component-provider-generic-type branch 2 times, most recently from 391e7a6 to d25ee3c Compare August 22, 2025 02:21
@@ -106,14 +75,10 @@ void create_OtlpHttpDefaults() {

assertThat(exporter.toString()).isEqualTo(expectedExporter.toString());

assertThat(exporter.toString()).isEqualTo(expectedExporter.toString());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just removing an existing duplicative line

@@ -216,14 +179,10 @@ void create_OtlpGrpcDefaults() {

assertThat(exporter.toString()).isEqualTo(expectedExporter.toString());

assertThat(exporter.toString()).isEqualTo(expectedExporter.toString());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just removing an existing duplicative line

@trask trask force-pushed the remove-component-provider-generic-type branch 4 times, most recently from c3590d0 to 6c64fe5 Compare August 22, 2025 02:48
@trask trask force-pushed the remove-component-provider-generic-type branch from 6c64fe5 to 5a22503 Compare August 22, 2025 02:48
@trask trask marked this pull request as ready for review August 22, 2025 03:23
@trask trask requested a review from a team as a code owner August 22, 2025 03:23
Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me.

Java generics strike again..... 🙈

OtlpHttpSpanExporter expectedExporter = OtlpHttpSpanExporter.getDefault();
OtlpHttpSpanExporter expectedExporter =
OtlpHttpSpanExporter.getDefault().toBuilder()
.setComponentLoader(capturingComponentLoader) // needed for the toString() check to pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bummer, but yeah ok.

@jkwatson
Copy link
Contributor

I'm fine with it. Don't know if we want to wait for @jack-berg or ask for forgiveness if he hates the change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants