Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Enforcing inheritance constraints to avoid improper API usage

Thanks Dimitar, I can confirm that's exactly why Eclipse bundles are not hermetically locked down.

It should be possible for clients to do experiments that break the rules.
http://help.eclipse.org/luna/topic/org.eclipse.platform.doc.isv/reference/misc/api-usage-rules.html

API Tools' @no* tags unfortunately weakened the established rules by stating restrictions, not permissions.
https://bugs.eclipse.org/220905

Markus



From:        Dimitar Georgiev <anakin.bg@xxxxxxxxx>
To:        "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
Date:        2014-07-03 11:07
Subject:        Re: [platform-ui-dev] Enforcing inheritance constraints to avoid improper API usage
Sent by:        platform-ui-dev-bounces@xxxxxxxxxxx




I think the reason is, that, even though the class is not intended to be subclassed, it -may have- to be subclassed in some circumstances. For example, there could be an API hole in Platform and a certain usecase which was not identified by the platform team could only be achieved by extending the class in question.
In such a scenario, if the class / method were marked final, the customer would not be able to compile.

The same is the rationale for packages which are named "internal" and are not supposed to be used, but still are OSGi-exported from the corresponding bundles.

I'm just a user so a contributor or commiter could confirm or reject my line of thought.

Regards, Dimitar


On 3.07.2014 06:59, Jeanderson wrote:
Hello folks,

I'm currently working in a GSoC project to add Generics support for JFace viewers.
While reviewing some code, I noticed the following pattern:
------------------------------------------------------------------------------------
/**
 * (...)
 *
 * @since (...)
 * @noextend This class is not intended to be subclassed by clients.
 *
 */
public class A [extends B [implements C]] { ... }
------------------------------------------------------------------------------------

Is there any special reason to not use "final" keyword? In addition, I'm not sure but I guess there are some methods documented like the former example.

I know that our work is reviewed by someone to prevent the addition of improper code (including the case that someone use bad sub-typing).
However, why waste time manually checking such constraints while the compiler could save time doing this?

I don't know if this is an issue at all, I would like to know your thoughts about this.

Best regards,
Jeanderson Barros Cândido
http://jeandersonbc.github.io


_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev

Back to the top