fix(java): fix dynamic snippets to correctly reference inline types as nested classes #11076
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.
Description
Refs: Slack thread from @tstanmay13
Fixes a bug where Java SDK dynamic snippets were referencing inline types from the wrong package location. When
enable-inline-typesis configured, types are generated as nested static classes within parent types (e.g.,GetDiscriminatedUnionRequest.Bar), but the snippet generator was trying to import them fromcom.seed.object.types.*where they don't exist.Link to Devin run: https://app.devin.ai/sessions/b8576a2505a54491902ab0e494874424
Requested by: [email protected] (@tstanmay13)
Changes Made
inlineflag to the dynamic IRDeclarationtype to track whether a type should be generated as a nested classDynamicSnippetsConverterto populate theinlineflag from the full IRDynamicSnippetsGeneratorContextthat:getJavaClassReferenceForNamedType()method that returns nested class references for inline typesDynamicTypeMapperandDynamicTypeLiteralMapperto use the new inline-aware methodTesting
java-inline-types:inlinejava-inline-types:no-inlinejava-inline-types:no-wrapped-aliasesjava-inline-types:enable-forward-compatible-enumspnpm run check)Human Review Checklist
getUniqueNestedName()matches the Java generator's collision handlinginlineproperty (lines 82-84, 320-322, 501) are safe workarounds until the SDK is publishedtraverseTypeForInlineChildren()handles all type structures correctly