Skip to content
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

Actual types passed to generic POJO super classes and to generic collection fields are ignored #5334

Open
eranl opened this issue Sep 14, 2023 · 2 comments

Comments

@eranl
Copy link

eranl commented Sep 14, 2023

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Giraffe | 2022.3.1 Patch 1
  • Firebase Component: Firestore
  • Component version: 24.6.1

[REQUIRED] Step 3: Describe the problem

Given the classes

  class BaseBean<T> {
    public T value;
  }

  class SubBean extends BaseBean<String> {}

if you try to deserialize into the sub-bean, you get java.lang.IllegalStateException: Could not resolve type T. Same is true for a base bean with a setter that takes a T parameter.

While debugging this, I found that given the classes

  class MapBean<T> {
    public Map<String, T> values;
  }

  class MapSubBean extends MapBean<String> {}

  class MapBeanHolder {
    public MapBean<String> map;
  }

deserializing into MapSubBean or MapBeanHolder, the code errs on the lenient side, and would accept any type of values into the values map.

I have a proposed backward-compatible fix for both issues. Should I post a PR?

I have posted this bug and the corresponding PR on the other version of this library (googleapis/java-firestore#1313 & googleapis/java-firestore#1323 respectively).

eranl added a commit to eranl/firebase-android-sdk that referenced this issue Sep 14, 2023
@argzdev
Copy link
Contributor

argzdev commented Sep 15, 2023

Hi @eranl, thanks for reaching out. Pull requests are most definitely welcome and are highly appreciated! That said, since you've also posted with the corresponding PRs in the other repos, I'll try to get some feedback from the assigned engineer and then we'll post back here once we get some updates.

@argzdev argzdev added type: feature request New feature or request and removed type: feature request New feature or request labels Sep 19, 2023
@argzdev
Copy link
Contributor

argzdev commented Sep 19, 2023

Just an update, this has been added to the roadmap, however since any change will need to be reviewed and approved by our engineers, this may take a bit of time. While we can't promise any timeline, rest assured this will be looked at once our engineers have the resources to see this through.

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

No branches or pull requests

3 participants