Gaffer
Gaffer copied to clipboard
Make use of Java 11 features/improvements
Describe the new feature you'd like Gaffer to make use of Java 11 code features/improvements.
Why do you want this feature? Currently the codebase can be built with Java 8 and Java 11, this means Java 11 specific improvements cannot be used in the codebase. Once support for Hadoop & Accumulo versions which require Java 8 compatibility has been dropped, Java 11 only code can be introduced.
Using Java 11 code features will allow for improved code quality, readability and reduced reliance on 3rd party dependencies (e.g. Guava).
Additional context A previous discussion about how Java 9+ try with resources could be used to improve the code can be found here.
Another example of a simple improvement would be changes to use of classes such as PrintStream to use Charset
directly without a need to convert into a String
first.
It would also be a good idea to remove illegal reflective access operations. While these do only warn for Java 11 it does create noise in logs and would need to removed to upgrade to any newer Java LTS version.
$ grep setAccessible . -r
./core/operation/src/test/java/uk/gov/gchq/gaffer/jobtracker/JobTrackerBrokenCacheTest.java: field.setAccessible(true);
./core/operation/src/main/java/uk/gov/gchq/gaffer/operation/Operation.java: field.setAccessible(true);
./core/store/src/test/java/uk/gov/gchq/gaffer/store/StoreTest.java: field.setAccessible(true);
./rest-api/common-rest/src/main/java/uk/gov/gchq/gaffer/rest/factory/AbstractExamplesFactory.java: field.setAccessible(true);
./rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/service/v2/PersistentCachingJobServiceV2IT.java: instance.setAccessible(true);
./rest-api/core-rest/src/test/java/uk/gov/gchq/gaffer/rest/ExampleGeneratorTest.java: field.setAccessible(true);