Skip to content

Illegal Reflective Access Warning #85

@thewalrusisben

Description

@thewalrusisben

When attempting to make a PATCH request (sendPayload method call), the following warning message is output:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.messagebird.MessageBirdServiceImpl (file:/Users/bensweeney23/dev/java-rest-api/examples/target/examples-3.0.6-jar-with-dependencies.jar) to field java.net.HttpURLConnection.methods
WARNING: Please consider reporting this to the maintainers of com.messagebird.MessageBirdServiceImpl
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

The issue appears to originate from inside of the allowPatchRequestsIfNeeded method, which does the following:

Field methodsField = HttpURLConnection.class.getDeclaredField("methods");
methodsField.setAccessible(true);

This didn't cause issues for me using the SDK, but it could for future users!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions