Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 573552

Summary: Missing warning for diamond operator
Product: [Eclipse Project] JDT Reporter: Carsten Hammer <carsten.hammer>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, stephan.herrmann
Version: 4.20   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1036
Whiteboard:

Description Carsten Hammer CLA 2021-05-15 07:37:29 EDT
In this case eclipse should give a warning (if enabled) to use diamond operator:

HashMap<String, Set<String>> hashMap = new HashMap<>();
hashMap.put("abc", new HashSet<String>());

The second line can be written:

hashMap.put("abc", new HashSet<>());

However, eclipse ignores this case.
Comment 1 Eclipse Genie CLA 2023-05-06 19:19:02 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Jay Arthanareeswaran CLA 2023-05-08 04:43:35 EDT
This is still an issue. I see that we return before invoking redundantSpecificationOfTypeArguments() since AllocationExpression#typeExpected is null. I will investigate.