java-rest-api icon indicating copy to clipboard operation
java-rest-api copied to clipboard

Illegal Reflective Access Warning

Open thewalrusisben opened this issue 5 years ago • 0 comments

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!

thewalrusisben avatar Jan 09 '20 10:01 thewalrusisben