Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

ApiXmlAdjuster fails to resolve parent type parameters for nested types #815

Description

@jpobst

Given a type like this:

class MapCollections<K, V> {
  class MapIterator implements Iterator<Map.Entry<K, V>>, Map.Entry<K, V> { 
    public K getKey() { ... }
  }
}

class-parse does not copy the parent's type parameters to the nested type:

<class
  jni-extends="Ljava/lang/Object;"
  extends="java.lang.Object"
  extends-generic-aware="java.lang.Object"
  name="MapCollections.MapIterator"
  jni-signature="Landroidx/collection/MapCollections$MapIterator;"
>
  <implements
    name="java.util.Iterator"
    name-generic-aware="java.util.Iterator&lt;java.util.Map.Entry&lt;K, V&gt;&gt;"
    jni-type="Ljava/util/Iterator&lt;Ljava/util/Map$Entry&lt;TK;TV;&gt;;&gt;;" />
  <implements
    name="java.util.Map.Entry"
    name-generic-aware="java.util.Map.Entry&lt;K, V&gt;"
    jni-type="Ljava/util/Map$Entry&lt;TK;TV;&gt;;" />
  <method
    name="getKey"
    return="K"
    jni-return="TK;"
    jni-signature="()Ljava/lang/Object;" />
...
</class>

ApiXmlAdjuster does not check parent types for type parameters, and thus cannot resolve K or V within this type:

Error while processing type '[Class] androidx.collection.MapCollections.MapIterator': Type 'K' was not found.
Error while processing type '[Class] androidx.collection.MapCollections.MapIterator': Type 'V' was not found.

Because the implements cannot be resolved, the nested type is removed from the binding.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions