Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366453 - [quick fix][1.7] "Add exception to existing catch clause" needs to be conditional
Summary: [quick fix][1.7] "Add exception to existing catch clause" needs to be conditi...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.18 M1   Edit
Assignee: Fabrice Tiercelin CLA
QA Contact: Carsten Hammer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-12 14:53 EST by Paul Benedict CLA
Modified: 2020-11-21 03:56 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Benedict CLA 2011-12-12 14:53:12 EST
Build Identifier: 20110916-0149

Multi-catch does not allow combining types that are in a super-subclass relationship. Quick fix should not offer "Add exception to existing catch clause" when the proposed type would violate this condition because it causes a compiler error (which is not a fix).

Reproducible: Always

Steps to Reproduce:
public class Test {
    public static void main(String[] args) {
        try {
            throw new Exception(); // fix here
        } catch (IOException e) { }
    }
}
Comment 1 Dani Megert CLA 2011-12-13 02:46:34 EST
Deepak, please take a look.
Comment 2 Eclipse Genie CLA 2020-01-05 17:39:06 EST
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 3 Dani Megert CLA 2020-01-06 03:57:21 EST
Still an issue in 4.14.
Comment 4 Fabrice Tiercelin CLA 2020-02-07 02:01:00 EST
I rather suggest to quickfix the code and remove the subtype from the union.
Comment 5 Eclipse Genie CLA 2020-09-16 04:48:57 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/169446
Comment 7 Noopur Gupta CLA 2020-09-18 04:34:43 EDT
(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/169446 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=05721b15b0cf730e35b405b515cc2cffcd613e80
> 

Please explain what this commit intends to do and what is the value add. The commit message just says "Cleanup before fixing it" and the released patch does not look like a simple clean up. For any other change related to quick fixes, tests need to be added.

Also, kindly set the Bugzilla fields correctly e.g. the target milestone so that it can be queried easily.
Comment 8 Fabrice Tiercelin CLA 2020-09-18 04:49:39 EDT
This first gerrit is a separate gerrit that only refactors the code and changes nothing. It merges common code and add empty newlines.

It is split from the implementation I'm currently coding to make it more readable.

PS: Thank you for the Target Milestone.
Comment 9 Noopur Gupta CLA 2020-09-18 05:18:24 EDT
Thanks for the explanation, Fabrice. Please add such description to the commit message and/or bug comment going forward so that everyone knows the reasoning behind the commit.
Comment 10 Eclipse Genie CLA 2020-09-18 10:05:10 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/169583
Comment 12 Fabrice Tiercelin CLA 2020-11-21 03:56:44 EST
Verified for 4.18M3 using I20201116-1800 build