microsoftgraph / microsoftgraph/msgraph-sdk-java

Proguard rules needed for PageIterator

未关闭
#2,265 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

type:enhancement
主要语言
Java
星标
444
派生
154
平均合并
18 小时 28 分钟
30 天内合并 PR
4

描述

Describe the bug

On Android with a minified build, an exception occurs with PageIterator over DriveItems. The PageIterator class calls getDeclaredMethod("getValue") on the response class. The response getValue method appears to be removed by the minified build.

Exception:

java.lang.IllegalAccessException: NO_COLLECTION_PROPERTY_ERROR
at com.microsoft.graph.core.tasks.PageIterator.extractEntityListFromParsable(PageIterator.java:300)
at com.microsoft.graph.core.tasks.PageIterator$Builder.build(PageIterator.java:203)
at com.microsoft.graph.core.tasks.PageIterator$Builder.build(PageIterator.java:210)
Expected behavior

Proguard rules provided by the library would include the needed classes/methods for PageIterator to work.

How to reproduce

Code:

var resp = 
        client.drives().byDriveId(driveId).items().byDriveItemId("root").children().get();

var pageIter =
        new PageIterator.Builder<DriveItem, DriveItemCollectionResponse>()
        .client(client)
        .collectionPage(resp)
        .collectionPageFactory(DriveItemCollectionResponse::createFromDiscriminatorValue)
        .processPageItemCallback(item -> {
                                        // use DriveItem item...
                                        return true;
                                    })
        .build();
pageIter.iterate();

SDK Version

6.24.0

Latest version known to work for scenario above?

No response

Known Workarounds

Add Proguard rule: -keep class com.microsoft.graph.models.DriveItemCollectionResponse { *; }

Debug output

No response

Configuration

No response

Other information

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 com.microsoft.graph.core.tasks.PageIterator 开始,重点查看 PageIterator.java:300 中的 extractEntityListFromParsable,并检查该库的 Android ProGuard 配置。复现经过 minify 的 DriveItem PageIterator 示例,然后验证随包提供的规则能够保留响应方法,并且 minify 后的迭代能够成功执行。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, java
领域
build-system, mobile
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。