‘<>‘ 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博客

相关推荐
编程(变成)小辣鸡1 小时前
如何防止接口被恶意刷?
java·后端·网络安全
大圣编程6 小时前
Java 多维数组详解
java·开发语言
万法若空8 小时前
【算法-查找】查找算法
java·数据结构·算法
HZZD_HZZD10 小时前
DL/T 645-2026新国标深度解读与智能电表协议适配实战:从帧结构变化到Java采集器升级的全链路改造方案
java·开发语言
山登绝顶我为峰 3(^v^)313 小时前
C/C++ 交叉编译方法
java·c语言·c++
一叶飘零_sweeeet13 小时前
Codex 与 Claude Code 深度拆解:两代 AI 编程智能体的技术本质与 Java 实战指南
java·ai·codex·claude code
Listen·Rain13 小时前
提示词和提示词模板
java·人工智能·spring boot
wuqingshun31415914 小时前
重写equals而不重写hashCode,会出什么问题?
java·开发语言
我今晚不熬夜14 小时前
Java语言实现Modbus协议通过用串口读取数据(以RTU为例)
java·网络协议