This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 159404 [details] Proposed changes Because of defect #256798 and related it seems better that ElementUtilities.findUnimplementedMethods() does *not* return default methods from interfaces, as they are not strictly speaking needed in order to complete the implementing class. At the same time findOverridableMethods should return those defaults for override. In some cases, however, it is desirable that findUnimplementedMethods return ALSO the default ones, so I want to add a parametrized variant. See the attachment for the proposed changes. I don't have strict use-case, but saw already code which could be argument for additional changes, but I don't want to extend the API speculatively: * flag to NOT return defaults among overridable methods * flag to NOT return methods, whose signatures would conflict with existing methods in the class (for both overridable and implementable methods) OR utility function to find methods which are in such signature conflict from among a given list: i.e. "implement methods" should not offer "int foo()" if "float foo()" already exists in the class, or it could handle it somehow specially
Y01 Typo "bud include" Y02 The API changes talk about "findOverridableMethods", but in the diff I see just findUnimplementedMethods with new parameter - the parameter is better, but possibly there is an inconsistency.
Y02: findOverridableMethod's behaviour changes; it used to ignore default methods in implemented interfaces. As for the missing parameter -- as I write in initial description, I don't have a strict use-case to return just superclass' overridable methods, but I have no strong opinion in neither direction. If the inability to ignore default methods is seen as a deficiency, I'll add a parametrized variant. Note that the default forms should probably each treat default methods differently: findUnimplementedMethods shoud NOT return them, since they are not required to implement for class completion, while findOverridableMethods SHOULD return them as their implementation is available for customization/change/override.
If no further objection is raised, I'll commit the patch tomorrow.
I am OK with the change.
Already pushed as http://hg.netbeans.org/jet-main/rev/486a20322671, but because of bugzilla outage, the notification was not added. It took a little longer, since I disovered other long standing issues with override/implements.