Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 574860 - [17][quick fix][sealed] declare sealed class as super class of permitted types
Summary: [17][quick fix][sealed] declare sealed class as super class of permitted types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.21 M2   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 572061
  Show dependency tree
 
Reported: 2021-07-15 07:44 EDT by Noopur Gupta CLA
Modified: 2021-08-18 05:57 EDT (History)
2 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 2021-07-15 07:44:25 EDT
public sealed class Shape permits Circle  { // [1]

}

public class Circle {

}

At [1], Circle has the error:
Permitted class Circle does not declare test2.Shape as direct super class

We should have a quick fix to declare Shape as direct super class of Circle.
Comment 1 Noopur Gupta CLA 2021-07-15 07:46:48 EDT
Note: If Circle already extends another super class then the quick fix will replace it with the proposed super class.
Comment 2 Eclipse Genie CLA 2021-07-20 08:01:19 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183194
Comment 4 Eclipse Genie CLA 2021-07-21 07:38:35 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/183233
Comment 6 Eclipse Genie CLA 2021-07-23 04:43:44 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183316
Comment 8 Sarika Sinha CLA 2021-08-13 13:18:18 EDT
Should we not add "non-sealed" to "Circle" as the default behaviour also to avoid a quick fix leading to compilation error?

Same for Bug 574860.
Comment 9 Noopur Gupta CLA 2021-08-16 03:09:16 EDT
(In reply to Sarika Sinha from comment #8)
> Should we not add "non-sealed" to "Circle" as the default behaviour also to
> avoid a quick fix leading to compilation error?
> 
> Same for Bug 574860.

A quick fix is a localized change for a particular compile error so I don't think we should fix another compile error with this one. 

We can do that while generating code via other means e.g. the new type wizards. 

Or, based on users' needs, we can add few more quick fixes along with this one to "Declare Shape as direct super class of Circle and change Circle to sealed/non-sealed/final".
Comment 10 Sarika Sinha CLA 2021-08-16 03:12:46 EDT
(In reply to Noopur Gupta from comment #9)
> (In reply to Sarika Sinha from comment #8)
> > Should we not add "non-sealed" to "Circle" as the default behaviour also to
> > avoid a quick fix leading to compilation error?
> > 
> > Same for Bug 574860.
> 
> A quick fix is a localized change for a particular compile error so I don't
> think we should fix another compile error with this one. 
> 
> We can do that while generating code via other means e.g. the new type
> wizards. 
> 
> Or, based on users' needs, we can add few more quick fixes along with this
> one to "Declare Shape as direct super class of Circle and change Circle to
> sealed/non-sealed/final".

Yes, one more new quick fix to add both sounds good to me.
Comment 11 Noopur Gupta CLA 2021-08-16 03:16:56 EDT
(In reply to Sarika Sinha from comment #10)
> Yes, one more new quick fix to add both sounds good to me.
Can you please open a new bug report for this?
Comment 12 Noopur Gupta CLA 2021-08-18 05:57:30 EDT
Verified in I20210817-1840.