‘<>‘ cannot be used with anonymous classes

'<>' cannot be used with anonymous classes

'<>'不能与匿名类一起使用

复制代码
Description	Resource	Path	Location	Type
'<>' cannot be used with anonymous classes	SearchHitSupport.java	/spring-data-elasticsearch/src/main/java/org/springframework/data/elasticsearch/core	line 95	Java Problem

java - Compile error: "'<>' cannot be used with anonymous classes" - Stack Overflow

But the Java compiler gives me the following error message:

复制代码
'<>' cannot be used with anonymous classes

Is there a fundamental reason for this? Or did the just skip the feature in JDK 7, maybe they do it in 8?

'<>' operator is not allowed for source level below 1.7_spencer_tseng的博客-CSDN博客

相关推荐
疯狂打码的少年几秒前
JDK 7、8、13 和 20区别深度了解
java·开发语言
钝挫力PROGRAMER1 分钟前
Java中如何优雅管理接口的多个实现
java·设计模式
迷藏4945 分钟前
# 发散创新:基于Python的自动特征工程实战与深度优化在机器学习
java·开发语言·python·机器学习
星晨雪海9 分钟前
查询区域列表并统计点位数量
java
Seven9710 分钟前
用300行代码手写一个mini版的Tomcat
java
隐退山林13 分钟前
JavaEE进阶:SpirngMVC入门(2)
java·java-ee
小江的记录本2 小时前
【分布式】分布式核心组件——分布式锁:Redis/ZooKeeper/etcd 实现方案(附全方位对比表)、优缺点、Redlock、时钟回拨问题
java·网络·redis·分布式·后端·zookeeper·架构
好家伙VCC2 小时前
**发散创新:用Rust实现基于RAFT共识算法的轻量级分布式日志系统**在分布式系统中,**一致性协议**是保障数据可靠
java·分布式·python·rust·共识算法
晔子yy3 小时前
【JAVA探索之路】从头开始讲透、实现单例模式
java·开发语言·单例模式
chools9 小时前
【AI超级智能体】快速搞懂工具调用Tool Calling 和 MCP协议
java·人工智能·学习·ai