Skip to content

Conversation

@alzimmermsft
Copy link
Contributor

Fixes an edge case in Java's generator when handling BinaryData -> primitive type conversion where it would default to BinaryData.toString(). This failed for primitive types as a String doesn't implicitly cast to boolean, byte, int, long, float, double, or char.

This is fixed by checking the raw return type for being !isNullable() (only primitives return true for this) and wrapping the BinaryData.toString() logic with String -> primitive conversion calls (Long.parseLong(String), Byte.parseByte(String), etc).

Updated response.tsp to include new routes to test this change.

@alzimmermsft alzimmermsft self-assigned this Nov 14, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Nov 14, 2025
@github-actions
Copy link
Contributor

No changes needing a change description found.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Nov 14, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Copy link
Member

@srnagar srnagar left a comment

Choose a reason for hiding this comment

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

LGTM

@alzimmermsft alzimmermsft added this pull request to the merge queue Nov 17, 2025
Merged via the queue into microsoft:main with commit dd644f1 Nov 17, 2025
26 checks passed
@alzimmermsft alzimmermsft deleted the Java_FixTextMimeTypeHandling branch November 17, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants