Skip to content

[generator] Generate Threshold{Class,Type} all classes (#154) #160

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 20, 2017

Conversation

jonpryor
Copy link
Contributor

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

If a class derives from Java.Lang.Object it should have the two properties
mentioned above generated, so that it is possible to find methods in the correct
instance of Java class instance that is wrapped by our managed class.

Generator used to decide whether or not to generate these properties based on
the presence of class members (fields, constructors, methods and properties) or
whether the class is an annotation in the API description file.

However there exist a number of classes (for instance Inet4Address) which don't
have any of the members present and yet they should have the Threshold*
properties generated for the reasons described above.

The HasClassHandle property which was used to determine whether the class should
get these properties (among a handful of other members) doesn't serve its
purpose correctly leading to corner cases when the Threshold* properties are
missing and causing runtime bugs (e.g. calling GetAddress() on an instance of
Inet4Address returns null even though the underlying Java class has the
information - the call never reaches Inet4Address instance and thus returns
nothing).

Replacing HasClassHandle with a simple check for whether the class in question
derives from Java.Lang.Object is the correct fix that ensures the missing
properties are generated.

…dotnet#154)

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

If a class derives from `Java.Lang.Object` it should have the two properties
mentioned above generated, so that it is possible to find methods in the correct
instance of Java class instance that is wrapped by our managed class.

Generator used to decide whether or not to generate these properties based on
the presence of class members (fields, constructors, methods and properties) or
whether the class is an annotation in the API description file.

However there exist a number of classes (for instance `Inet4Address`) which don't
have any of the members present and yet they should have the Threshold*
properties generated for the reasons described above.

The `HasClassHandle` property which was used to determine whether the class should
get these properties (among a handful of other members) doesn't serve its
purpose correctly leading to corner cases when the `Threshold*` properties are
missing and causing runtime bugs (e.g. calling `GetAddress()` on an instance of
`Inet4Address` returns `null` even though the underlying Java class has the
information - the call never reaches `Inet4Address` instance and thus returns
nothing).

Replacing `HasClassHandle` with a simple check for whether the class in question
derives from `Java.Lang.Object` is the correct fix that ensures the missing
properties are generated.
@jonpryor jonpryor merged commit bdad4a1 into dotnet:d15-3 Jun 20, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants