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

相关推荐
想做小南娘,发现自己是女生喵20 分钟前
第 2 章 顺序表和 vector
java·数据结构·算法
CHANG_THE_WORLD1 小时前
6.多线程的TCP通信
java·网络·tcp/ip
sun03222 小时前
【笔记】Spring MVC 相关介绍
java·spring·mvc
兰令水2 小时前
hot100【acm版】【2026.7.18打卡-java版本】
java·开发语言·算法
CoderYanger3 小时前
A.每日一题:3020. 子集中元素的最大数量
java·程序人生·算法·leetcode·面试·职场和发展·学习方法
wear工程师3 小时前
CompletableFuture 的 allOf 到底怎么收结果?面试别只说并行
java·后端
倒流时光三十年3 小时前
Logback 系列(3):三大核心组件 Logger / Appender / Encoder
java·开发语言·logback
什巳4 小时前
JAVA练习312- 二叉搜索树中第 K 小的元素
java·数据结构·算法·leetcode
倒流时光三十年4 小时前
Logback 系列(7):常用 Appender(控制台 / 文件 / 滚动文件)
java·前端·logback
极客先躯4 小时前
高级java每日一道面试题-2026年04月18日-实战篇[Docker]-如何处理金融行业的时序数据容器化?
java·运维·docker·容器·金融·时序数据·高级面试