Bug 567667 - [quick assist] Pattern matching for instanceof
Summary: [quick assist] Pattern matching for instanceof
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on: 571942
Blocks: 566001
  Show dependency tree
 
Reported: 2020-10-07 06:28 EDT by Noopur Gupta CLA
Modified: 2021-07-02 10:38 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.