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 摘要。