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

相关推荐
人活一口气4 小时前
Spring Boot与AIGC的完美结合:从零搭建智能内容生成平台
java·spring boot·aigc
像我这样帅的人丶你还6 小时前
Java 后端详解(三):全局异常处理与 JPA 数据库映射
java·后端
NE_STOP6 小时前
vibe Coding -- 小项目实战
java
未秃头的程序猿12 小时前
Java 26正式发布!这3个新特性,让代码量直接减半
java·后端·面试
用户2986985301413 小时前
Word 文档文本查找与替换的 Java 实现方案
java·后端
阿哉13 小时前
Nacos 服务发现源码:藏在背后的两套事件机制,90%的人只讲了一半
java
咖啡八杯13 小时前
GoF设计模式——命令模式
java·设计模式·架构
AI人工智能_电脑小能手13 小时前
【大白话说Java面试题 第125题】【并发篇】第25题:说说 Java 线程的中断机制
java·后端·面试
Java内核笔记13 小时前
Spring Security 源码解析(六)无状态 JWT 实践:Session 共享与自定义过滤器
java·后端
荣码13 小时前
LangGraph多Agent协作:3个Agent干活比1个强,但我踩了4个坑
java·python