Skip to content

Metadata <remove-attr> doesn't work as expected #976

@jpobst

Description

@jpobst

Given an api.xml element like:

<package name='my.package'>
  <class name='MyClass' api-since='29' />
</package>

You would expect to be able to remove the api-since attribute with this metadata:

<remove-attr path='/api/package[@name='my.package']/class[@name='MyClass']' name='api-since' />

However, even though generator reads the name attribute, it then proceeds to ignore it and remove all attributes on the matched node. This seems unintuitive, and I'm not sure how this could ever be successfully used in a binding project, since leaving an empty <class>, etc. node causes generator to crash.

Relevant code:
https://github.com/xamarin/java.interop/blob/0c90cf5cd67c5bd4978fbcf016281d330426989f/src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs#L149-L167

<remove-attr> seems to be undocumented: https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/customizing-bindings/java-bindings-metadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugComponent does not function as intendedgeneratorIssues binding a Java library (generator, class-parse, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions