Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Ensure "global::" is prepended to generic return casts. #838

Merged
merged 1 commit into from
May 13, 2021

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented May 13, 2021

Context: dotnet/android#5894

When creating the cast from a generic type parameter (which is currently always JLO), global:: is not prepended to the type cast.

return (Java.Lang.Object) global::Java.Lang.Object.GetObject<global::Java.Lang.Object> (__rm.Handle, JniHandleOwnership.TransferLocalRef);

This creates a compilation error if the bound type is in a namespace that ends in "Java", like "MyProduct.Java".

Error CS0234: The type or namespace name 'Lang' does not exist in the namespace 'MyProduct.Java'.

Fix this by ensuring the cast output goes through our standard type formatting method which adds global:: when needed.

@jpobst jpobst marked this pull request as ready for review May 13, 2021 15:49
@jonpryor jonpryor merged commit 100fffc into main May 13, 2021
@jonpryor jonpryor deleted the global-jlo branch May 13, 2021 18:09
@jpobst jpobst added this to the 11.4 (16.11 / 8.11) milestone Jun 15, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants