Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 109170

Summary: [quick fix] add constructor does not work if superconstructor is invisible
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Brian.Miller, dirk_baeumer
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2005-09-09 12:15:54 EDT
I20050906-1200

public class Claws {
	private Claws(int i) { }
}

class Extends extends Claws {
	
}

For "Extends", there's a quick fix lightbulb, but when you click on it, the only
proposal is "Rename in File". The lightbulb should not show up if there's no
quick fix. OTOH, I think it would be good to just create the constructor and
call the invisible superconstructor. That would at least tell the user in an
error, that the superconstructor is not visible (and allows to correct it with
another quick fix).

The "Source > Add Constructors from Superclass" action does not show the private
superconstructor but only offers the constructor from Object, which is also
wrong. I guess that's the same code; if not, I can open another bug report for
the source action.
Comment 1 Dirk Baeumer CLA 2005-09-09 13:30:55 EDT
Tobias, can you please comment on whether this is the same code.
Comment 2 Tobias Widmer CLA 2005-09-12 10:51:05 EDT
No, this is not the same code. The source actions do not offer super 
constructors which are not visible.
We should either issue an error if invisible constructors would be called or 
offer them anyway to let the user fix the problem afterwards.
Comment 3 Dirk Baeumer CLA 2005-09-13 18:08:55 EDT
Tobias, can we offer the constructor and somehow mark them (special icon) so
that the user now that they are in fact invisible. Can you do the change and
then forward the bug to Martin to comment on the quick fix.
Comment 4 Brian Miller CLA 2008-04-09 13:09:54 EDT
I agree that offering to invoke an invisible superconstructor would be bad.

But all superconstructors in the same compilation unit are implicitly visible, and should be offered.
Comment 5 Eclipse Genie CLA 2020-05-06 17:33:32 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.