Skip to main content

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

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

Back to the top