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

相关推荐
多敲代码防脱发2 小时前
Spring进阶(BeanFactory与ApplicationContext)
java·数据库·spring boot·后端·spring
吴声子夜歌2 小时前
Java——反射
java·反射
JAVA面经实录9172 小时前
完整版JVM 深度学习体系(二)
java·jvm
.ZGR.3 小时前
线程池相关知识及并发统计案例实现
java·开发语言
慕言手记3 小时前
IDEA 插件常用-2026版
java·ide·spring boot·intellij-idea·idea·intellij idea
颖火虫盟主3 小时前
Hello World MCP Server 实现总结
java·前端·python
iiiiyu3 小时前
⾯向对象和集合编程题
java·大数据·开发语言·数据结构·编程语言
超級二蓋茨3 小时前
asp.net core中JwtBearerEvents中几个事件的生命周期
java·服务器·asp.net
Full Stack Developme3 小时前
Spring-web 解析
java·前端·spring
devilnumber3 小时前
如何在java的Lambda中安全地修改外部变量?
java·安全·lambda