Skip to content

Configure jsonSchema2Pojo to not initialize collections#8356

Open
jack-berg wants to merge 1 commit intoopen-telemetry:mainfrom
jack-berg:fix-include-exclude-bug
Open

Configure jsonSchema2Pojo to not initialize collections#8356
jack-berg wants to merge 1 commit intoopen-telemetry:mainfrom
jack-berg:fix-include-exclude-bug

Conversation

@jack-berg
Copy link
Copy Markdown
Member

Fixes #8337.

Currently, all collection types in generated pojos initialize to new ArrayList<>(). This prevents us from being able to differentiate between null and empty, which is key to implementing declarative config semantics.

@jack-berg jack-berg requested a review from a team as a code owner May 1, 2026 17:26
Arguments.of(new ViewStreamModel().withAttributeKeys(null), View.builder().build()),
// attribute_keys with only included (no excluded) - reproduces
// https://github.com/open-telemetry/opentelemetry-java/issues/8337
Arguments.of(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This new test case fails without the change to build.gradle.kts.

Refactored these tests to follow the parameterized test pattern used elsewhere in these declarative config factory tests.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.85%. Comparing base (b87fa99) to head (a9bdc8b).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8356      +/-   ##
============================================
+ Coverage     90.82%   90.85%   +0.03%     
- Complexity     7927     7936       +9     
============================================
  Files           895      895              
  Lines         23872    23872              
  Branches       2378     2378              
============================================
+ Hits          21681    21690       +9     
  Misses         1446     1446              
+ Partials        745      736       -9     

☔ 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.

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.

Metric View in declarative config need included and excluded Block for attribute_keys

1 participant