Skip to content

ApiXmlAdjuster prefers JavaList over ArrayList #853

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

Closed
jpobst opened this issue Jun 17, 2021 · 1 comment
Closed

ApiXmlAdjuster prefers JavaList over ArrayList #853

jpobst opened this issue Jun 17, 2021 · 1 comment
Labels
bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.)

Comments

@jpobst
Copy link
Contributor

jpobst commented Jun 17, 2021

Consider the type:

<class abstract="false" deprecated="not deprecated" extends="java.util.ArrayList" final="false" jni-extends="Ljava/util/ArrayList;" jni-signature="Landroidx/databinding/ObservableArrayList;" name="ObservableArrayList" static="false" visibility="public">
...
</class>

When ApiXmlAdjuster attempts to resolve the base type of java.util.ArrayList, there are 2 choices:

[Register("java/util/ArrayList", DoNotGenerateAcw=true)]
public class Android.Runtime.JavaList : Java.Lang.Object { ... }

[Register("java/util/ArrayList", DoNotGenerateAcw=true)]
public class Java.Util.ArrayList : Java.Util.AbstractList { ... }

Because we simply use the "first" type we come across that matches, we are using JavaList instead of ArrayList. This means when we try to resolve overrides for methods, it will not find base methods such as void clear ().

Practically this isn't that big of a deal. This affects code that removes "excess" overrides that we don't need to generate. (ie: we don't need to generate an override if it's the same as the base class's method.) The net result is just that we generate these extra unneeded methods.

Largely this is just an "unspecified" behavior that breaks comparisons with the new Java type resolver.

@jpobst jpobst added bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.) labels Jun 17, 2021
@jpobst
Copy link
Contributor Author

jpobst commented Jun 25, 2021

Full list:

  • Android.Runtime.JavaCollection
  • Android.Runtime.JavaDictionary
  • Android.Runtime.JavaList
  • Android.Runtime.JavaSet

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.)
Projects
None yet
Development

No branches or pull requests

1 participant