Community
Participate
Working Groups
i20041201 Code assist allows overriding super class private method. Superclass' private members should be omitted instead. Example: class A { private void m1() {} } class B extends A { } Triggering code assist inside B's body will offer to "override" A's m1() method, which is private and cannot be overriden, resulting in: class A { private void m1() {} } class B extends A { private void m1() {} } Where B's m1 method is completely unrelated to A's m1 method. The resulting code is valid but it is not what the developer intended (which was to override a super class' method).
The proposals are generated by JDT/Core.
private methods are only proposed if the option "Preferences>Java>Editor>Sorting and filtering>Show only proposals visible in the invocation context" is unchecked.
Yeah, I have it unchecked. I can see the usefulness of proposing private methods to callers, because an error marker will be added and the user can then use quick fix to easily change the member visibility. I have used this feature myself. But when overriding methods, I think it is misleading (besides being plain useless).
Fixed and test added CompletionTests#testCompletionMethodDeclaration11()
Verified in I20050510-0010 + JDT/Core v_556