-
Notifications
You must be signed in to change notification settings - Fork 534
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
Audit Mono.Android
enums for missing [Flags]
#7416
Comments
There are a lot of missing flag attributes if I take a look in map.csv. It could be autodetected by parsing the Java class annotations:
More documentation: https://developer.android.com/reference/androidx/annotation/IntDef |
I explored using the annotations, and while it gives us hints, there appear to be plenty of examples where they are wrong, so we can't just automatically trust them. For example, it lists these microphone locations as a set of flags: https://developer.android.com/reference/android/media/MicrophoneInfo?hl=en#getLocation() The values are:
I do not think a mic located on a "peripheral" is a combination of a mic on the "mainbody" and a movable mic on the "mainbody". Some more examples that annotations declare as flags that I am skeptical about:
|
…8310) Fixes: #7416 We were hoping we could use the data that Google provides in `annotations.xml` to create a better process for identifying which sets of constants should be a `[Flags]` enum. However, the data is too dirty to create anything automatically (incorrect data from Google, constants groups that don't map 1:1 to our enums, etc.). However, it did provide a large list of potential candidates. These candidates were manually compared to the Android documentation and appropriate ones have been updated to be generated with the `[Flags]` attribute.
Context: #7409
I suspect there are many enums that are intended to be
[Flags]
but are missing the attribute.It would be nice to write something that looks at the integer values of each enum and gave us a heads-up if the values look "flag-like" but the attribute has not been specified.
The text was updated successfully, but these errors were encountered: