Community
Participate
Working Groups
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.
Note: If Circle already extends another super class then the quick fix will replace it with the proposed super class.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183194
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183194 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=c8fca3525f83543877276169e429b873c702f1d4
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/183233
Gerrit change https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/183233 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=1f82ade766b5317b50d2e055dc9c2d62f38e4807
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183316
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/183316 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=a067a3c2cff6663da5fb2536f13916540ae28453
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.
(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".
(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.
(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?
Verified in I20210817-1840.