Skip to content

[api-xml-adjuster] method overrides cannot expose non-public types.#94

Merged
jonpryor merged 1 commit intodotnet:masterfrom
atsushieno:generator-do-not-expose-nonpublic
Oct 13, 2016
Merged

[api-xml-adjuster] method overrides cannot expose non-public types.#94
jonpryor merged 1 commit intodotnet:masterfrom
atsushieno:generator-do-not-expose-nonpublic

Conversation

@atsushieno
Copy link
Copy Markdown
Contributor

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=44531

When a Java method is overriden, its parameter type or return type can be
variant, which possibly result in exposure of non-public types (returning
private class object which is derived from public type is totally valid).

It is because we blindly emit the parsed type from class-parse output
as the API XML adjuster output. It needs to be examined and adjusted to
be public (or protected) type.

jar2xml didn't have this problem because Java reflection API is clever
enough to cover that issue.

The fixes are... not cosmetic.

Basically now we use TypeReference.ToString() which used to not be
precise and ready for API XML output. So there are couple of fixes
for that. (We also want to track from which method base a parameter
or return type is bound, so we pass that to the .ctor now).

We hide extraneous public TypeParameter.ctor() now to reduce chances
for bugs. Tests need to be modified to reflect the changes.

Lastly, Mono.Android API XML will be updated to reflect this change.
There will be some removal of method overrides from api-*.xml.in but
there was no regression reported from api-diff.

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

3 participants