| Summary: | ClassCastException on open declaration (F3) on field | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Nicolas Baumann <nicolas.baumann1> | ||||
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | Jay Arthanareeswaran <jarthana> | ||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | kalyan_prasad, loskutov | ||||
| Version: | 4.22 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 10 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 287743 [details]
stacktrace
Moving to JDT Core. This looks like caused by fix to bug 561132, that introduced a LocalDeclaration into the astStack. But presence of a lambda upsets the flow. I think we should revisit the fix to the said bug rather than fixing it. Will take a look at. Issue solved in Eclipse 2022-06. Thanks. |
A minimal example below. The error happens on field 'executors' and seems related to the new syntax of instanceof. Version: 2021-12 (4.22.0) Build id: 20211202-1639 import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import javax.swing.SwingUtilities; public class MainController { private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); public void testOK(Object o) { executor.submit(() -> { SwingUtilities.invokeLater(() -> { if (o instanceof Runnable) { Runnable r = (Runnable)o; r.run(); } }); }); } public void testKO(Object o) { executor.submit(() -> { SwingUtilities.invokeLater(() -> { if (o instanceof Runnable r) { r.run(); } }); }); } }