java-rest-api
java-rest-api copied to clipboard
Illegal Reflective Access Warning
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!