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

相关推荐
消失的旧时光-19435 分钟前
智能指针(三):实现篇 —— shared_ptr 的内部设计与引用计数机制
java·c++·c·shared_ptr
芒克芒克8 分钟前
深入浅出CopyOnWriteArrayList
java
wuqingshun31415918 分钟前
说一下java的反射机制
java·开发语言·jvm
A懿轩A22 分钟前
【Java 基础编程】Java 异常处理保姆级教程:try-catch-finally、throw/throws、自定义异常
java·开发语言·python
极客先躯30 分钟前
高级java每日一道面试题-2025年7月14日-基础篇[LangChain4j]-如何集成开源模型(如 Llama、Mistral)?需要什么基础设施?
java·langchain·存储·计算资源·模型服务框架·网络 / 协议·java 依赖
黎雁·泠崖1 小时前
Java 包装类:基本类型与引用类型的桥梁详解
java·开发语言
盖头盖2 小时前
【Java反序列化基础】
java
极客先躯2 小时前
高级java每日一道面试题-2025年7月15日-基础篇[LangChain4j]-如何集成国产大模型(如通义千问、文心一言、智谱 AI)?
java·人工智能·langchain·文心一言·异常处理·密钥管理·参数调优
追随者永远是胜利者2 小时前
(LeetCode-Hot100)226. 翻转二叉树
java·算法·leetcode·职场和发展·go
芒克芒克3 小时前
深入浅出Java线程池(一)
java·开发语言