zoukankan      html  css  js  c++  java
  • 运行开源项目,报错Error:(48, 37) 错误: -source 1.6 中不支持 diamond 运算符,请使用-source 7或者更高版本已启用diamond运算符

    错误定位

    当时并没有弄明白为什么会出错,一脸懵逼相

    解决办法:

    将source compatibility和target compatibility都改为1.7,重新build就ok了。

    错误原因:

    官方解释

    You can replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can infer the type arguments from the context. This pair of angle brackets is informally called the diamond.

    For example, consider the following variable declaration:

    Map<String, List<String>> myMap = new HashMap<String, List<String>>();

    In Java SE 7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>):

    Map<String, List<String>> myMap = new HashMap<>();



  • 相关阅读:
    6.4 总结(关于正确率)
    POI2013 Bytecomputer
    BZOJ1485 有趣的数列
    PAM
    BZOJ1787 meet
    BZOJ3895 rock
    URAL 1996 Cipher Message 3
    BZOJ1468 Tree
    Javascript初识之数据类型
    Javascript初识之流程控制、函数和内置对象
  • 原文地址:https://www.cnblogs.com/mbp-study/p/5681799.html
Copyright © 2011-2022 走看看