The development tool used is idea, the version of jdk is 1.8, and jdk1.7 provides diamond syntax. After jdk1.7, declaring a generic type does not need to write the type in angle brackets, otherwise it will be redundant.
Previous writing:
List<String> strList = new ArrayList<String>();
After writing:
List<String> strList = new ArrayList<>();
When a new generic variable is not written with the type in the angle brackets, an error is reported: Diamond types are not supported at this language level, the solution is as follows:
First: Check whether the configuration in File-->Project Structure-->Project is java8
Second: Is java8 configured in File-->Project Structure-->Modules
Step 3: After completing the previous two steps, no error will be reported, then run it. As a result, the error in the compilation phase is as follows:
Reason: The version in the project is inconsistent
Solution: File-->Settings-->