[api-xml-adjuster] method overrides cannot expose non-public types.#94
Merged
jonpryor merged 1 commit intodotnet:masterfrom Oct 13, 2016
Merged
Conversation
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.