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

相关推荐
yaoyouzhong1 分钟前
基于SpringBoot和PostGIS的云南与缅甸的千里边境线实战
java·spring boot·spring
姗姗的鱼尾喵31 分钟前
Spring/SpringBoot 面试高频(含IOC/AOP/事务)
java·spring boot·面试
Mr_Xuhhh1 小时前
从理论到实践:深入理解算法的时间与空间复杂度
java·开发语言·算法
望眼欲穿的程序猿1 小时前
Vscode Clangd 无法索引 C++17 或者以上标准
java·c++·vscode
带刺的坐椅1 小时前
Spring-AI 与 Solon-AI 深度对比分析报告
java·spring·ai·llm·solon·spring-ai·solon-ai
爱码少年1 小时前
JAVA获取客户端真实IP地址经典写法与Lambda写法对比
java
做个文艺程序员1 小时前
Spring AI + Qwen3.5 实现多步 Agent:从工具调用到自主任务拆解的踩坑全记录
java·人工智能·spring
gentle_ice2 小时前
初入社会的我该何去何从
java
Kiling_07042 小时前
Java多态、final与抽象类:面向对象编程进阶指南
java·开发语言
better_liang2 小时前
每日Java面试场景题知识点之-MySQL索引
java·数据库·mysql·性能优化·索引