Bug 567667

Summary: [quick assist] Pattern matching for instanceof
Product: [Eclipse Project] JDT Reporter: Noopur Gupta <noopur_gupta>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: carsten.hammer, fabrice.tiercelin, jjohnstn, jkubitz-eclipse, kalyan_prasad, karsten.thoms, Lars.Vogel
Version: 4.18Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 571942    
Bug Blocks: 566001    

Description Noopur Gupta CLA 2020-10-07 06:28:29 EDT
+++ This bug was initially created as a clone of Bug #566001 +++

Use pattern matching for the instanceof operator when possible

Given:
if (object instanceof Integer) {
    Integer i = (Integer) object;
    return i.intValue();
}

When:
Clean up the code enabling "Use pattern matching for instanceof"

Then:
if (object instanceof Integer i) {
    return i.intValue();
}
Comment 1 Noopur Gupta CLA 2020-10-07 06:29:16 EDT
Bug 566001 provides a clean up for this. It will be nice to have it as a quick assist (ctrl+1) also.
Comment 2 Kalyan Prasad Tatavarthi CLA 2020-11-25 01:14:39 EST
This would be an important feature to have in 4.19 M1 as instanceof pattern will become a standard feature for Java 16.
Comment 3 Noopur Gupta CLA 2021-01-05 03:26:41 EST
Ping!
Comment 4 Jörg Kubitz CLA 2021-07-02 10:06:35 EDT
(In reply to Noopur Gupta from comment #3)
> Ping!

you better assign someone else as the assignee left eclipse
Comment 5 Noopur Gupta CLA 2021-07-02 10:38:39 EDT
(In reply to Jörg Kubitz from comment #4)
> (In reply to Noopur Gupta from comment #3)
> > Ping!
> 
> you better assign someone else as the assignee left eclipse
Thanks, updated the Bugzilla fields.