Milling Project Coin [JEP 213]
Project Coin was a feature set of minor changes introduced in Java 7. These changes are listed as follows:
- Strings in
switchstatements - Binary integral literals
- Using underscores in numeric literals
- Implementing multi-catch
- Allowing for more precise re-throwing of exceptions
- Generic instance creation improvements
- Addition of the
try-with-resourcesstatement - Improvements to invoking
varargsmethods
Detailed information can be found in the following Oracle presentation: http://www.oracle.com/us/technologies/java/project-coin-428201.pdf.
JEP 213 focused on improvements to Project Coin's enhancements. There were five such enhancements, each detailed as follows.
Using the @SafeVarargs annotation
In Java 9, we can use the@SafeVarargsannotation with private instance methods. When we use this annotation, we are asserting that the method does not contain any harmful operations on the varargs passed as parameters to the method.
The syntax for usage is:
@SafeVarargs // this is...