microsoftgraph / microsoftgraph/msgraph-sdk-java

Proguard rules needed for PageIterator

Open
#2,265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:enhancement
Dominant language
Java
Stars
444
Forks
154
Avg merge
18h 28m
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at com.microsoft.graph.core.tasks.PageIterator, especially extractEntityListFromParsable at PageIterator.java:300, and inspect the library's Android ProGuard configuration. Reproduce the minified DriveItem PageIterator example, then verify that a packaged rule preserves the response method and minified iteration succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
build-system, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.