[generator] Don't special case synthetic methods
#348
Merged
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.
Context: dotnet/android#1998 (comment)
Context: https://github.com/xamarin/monodroid/commit/2c515356d9a671f729aff2e81c4c2f6184749722
Long ago,
generatorwas written to consume API XML descriptionsprovided by Google. This approach worked reasonably well until
Honeycomb, at which point Google didn't provide an XML API description
when the API-H
android.jarwas released.The fix was
jar2xml, which used Java Reflection aroundandroid.jarto generate a similar API XML description which
generatorcould use.jar2xmlin turn had its own share of problems, which resulted inclass-parse, which had a different share of problems. :-)The original hope was that
generatorcould directly useclass-parseoutput. Turns out, it wasn't that easy, henceXamarin.Android.Tools.ApiXmlAdjuster, which tookclass-parseoutput and "munged" it into something resembling
jar2xmloutput(e.g. with respect to whether method overrides were included).
However, before
Xamarin.Android.Tools.ApiXmlAdjusterexisted, Itried to get
generatorto consumeclass-parseoutput directly, andin that spirit xamarin/monodroid@2c515356 updated
generatorto skipprocessing of
syntheticmethods:However, the scenario monodroid@2c515356 attempted to address --
direct support for
class-parseoutput -- is not something that hasever been used, or been tested, or even worked.
Thus, the special-casing of
syntheticmethods is effectively deadcode, all the more so because
Xamarin.Android.Tools.ApiXmlAdjusternever emitted the
//method/@syntheticattribute in the first place,so
generators special-casing ofsyntheticmethods was never hit....until 0881acc, which updated
Xamarin.Android.Tools.ApiXmlAdjusterto include and copy over allsource attributes, including
//method/@synthetic.NOW
generatorbegan to see methods with//method[@synthetic='true'], and skip them.The resulting code compiled, but had ABI breakage.
Remove the special-casing logic for
syntheticmethods fromgenerator. monodroid@2c515356 never supported direct consumptionof
class-parseoutput bygenerator, meaning such an effort willrequire more work anyway, and removing
syntheticspecial-casing fromgeneratorwill allow it to consume post-0881accdXamarin.Android.Tools.ApiXmlAdjusteroutput without breaking things.