eclipse-paho / eclipse-paho/paho.mqtt.java
FileLock may stop working in future versions of Java
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
Please fill out the form below before submitting, thank you!
- [x] Bug exists Release Version 1.2.0 ( Master Branch)
- [x] Bug exists in Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
- [x] Bug exists in MQTTv5 Version (mqttv5-new Branch)
When compiling and testing against a Java 9 JVM, the following warning is logged:
```
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.paho.client.mqttv3.internal.FileLock (file:/Users/jsutton/ibm/paho/git/paho.mqtt.java/org.eclipse.paho.client.mqttv3/target/classes/) to method sun.nio.ch.FileLockImpl.release()
WARNING: Please consider reporting this to the maintainers of org.eclipse.paho.client.mqttv3.internal.FileLock
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
```
This is refering to the fact that [FileLock.java](https://github.com/eclipse/paho.mqtt.java/blob/master/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/FileLock.java) uses reflection to check if the `java.nio.channels.FileLock` API is available, before then calling it.
The reason that this was written this way was to maintain support with JME MIDP which did not have the FileLock API available at the time. It would be worth doing some investigation to see whether this API is available in the latest versions of Java ME 8. If it is, then we can clean this class up considerably!
Contributor guide
Assessment
This issue has not been assessed yet.