Skip to content

Can't access public static fields inherited from a protected static interface from scala code #9272

@scabug

Description

@scabug

this code, for a very ugly API:

val ops: java.util.ArrayList[ContentProviderOperation] = new java.util.ArrayList[ContentProviderOperation]
    ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
            .withValue(RawContacts.ACCOUNT_TYPE, AccountType)
            .withValue(RawContacts.ACCOUNT_NAME, AccountName).build)

doesn't compile

[error] <snip>.scala:63: value ACCOUNT_TYPE is not a member of object android.provider.ContactsContract.RawContacts
[error]             .withValue(RawContacts.ACCOUNT_TYPE, AccountType)
[error]                                    ^
[error] <snip>.scala:64: value ACCOUNT_NAME is not a member of object android.provider.ContactsContract.RawContacts
[error]             .withValue(RawContacts.ACCOUNT_NAME, AccountName).build)

RawContacts is a public static class which implements the SyncColumns protected static interface (among others), both defined in android.provider.ContactsContract.
RawContacts inherits those public static fields from SyncColumns, but scalac just doesn't see them.

The scaloid guy wrote a workaround but it's only a hardcoded bridge for this specific API. Note that he refers to #1086 but that seems like a different bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions