Bug 220905 - API tooling does not play well with API guidelines
Summary: API tooling does not play well with API guidelines
Status: CLOSED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: PDE API Tools Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 225756 (view as bug list)
Depends on: 409428 409429
Blocks:
  Show dependency tree
 
Reported: 2008-02-29 04:44 EST by Dani Megert CLA
Modified: 2019-09-11 12:55 EDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2008-02-29 04:44:06 EST
I20080226-1155.

The new API tooling is based on tags that forbid things (@noimplement, @noinstantiate, @noextend). Unfortunately this does not play well with the Eclipse API guidelines:
http://www.eclipse.org/articles/article.php?file=Article-API-Use/index.html

In those guidelines everything is forbidden by default unless otherwise stated in the Javadoc, e.g.:
>Classes that are designed to be subclassed by clients are explicitly flagged in >the Javadoc class comment (with words like "Clients may subclass.").


Look at this example:
/**
 * A class.
 */
public class A {
}

==> according to the API guidelines this class is not allowed to be subclassed. With the introduction of API tooling this is now considered to be subclassable as there are not tags prohibiting this.


I marked this bug critical because I cannot yet see how the tooling plays together with the Eclipse API guidelines. Also, it's not clear whether we only have to use the tags or whether we still have to put the verbose text into the Javadoc. In case of mismatch between tags and verbose Javadoc it's also not clear for clients which version wins.
Comment 1 Dani Megert CLA 2008-02-29 04:54:44 EST
Looking at the Eclipse SDK there are lots of cases where classes are subclassed that do not explicitly allow this in the Javadoc. Maybe it would be a good point in time now to adjust the guidelines to say that when using API tags, everything is allowed if there is no tag. Somewhere (e.g. manifest.mf) a project would have to specify whether they use API guideline version 1.0 or 2.0.

Adding Jeem who wrote the guidelines.
Comment 2 Darin Wright CLA 2008-02-29 09:25:31 EST
Removing critical. I disagree. API tooling is based on explicit API descriptions. We have many cases were classes not documented with explicit restrictions means there are no restrictions. I recall forgetting to put restrictions on classes in javadoc, and then having to get PMC approval to add restrictions in a later release - which was considered a breaking change.
Comment 3 Olivier Thomann CLA 2008-02-29 13:34:30 EST
We wrote our restrictions based on what was done for the component.xml file and it was clear at that time that no restrictions meant that implement, extends or instantiate was allowed.

If by default all restrictions are on, why the restrictions are explicitly specified in the Eclipse javadoc APIs?
Comment 4 Darin Wright CLA 2008-03-03 16:29:05 EST
The tooling could be made extensible/customizeable to allow for different tags/comments, or to allow for "no tag" to mean specific things. However, I'm not sure it's a good idea as those settings would always have to be shipped with the source code in order for tools to interpret the tags (or lack of tags) - for example, source import. Having standard/explicit tags makes the documentation more portable/re-useable.

Marking as won't fix.
Comment 5 Dani Megert CLA 2008-03-10 06:46:13 EDT
Then at least the API guidelines should be updated to be in sync.
Comment 6 Darin Wright CLA 2008-04-04 11:25:12 EDT
*** Bug 225756 has been marked as a duplicate of this bug. ***
Comment 7 Boris Bokowski CLA 2008-04-07 09:55:36 EDT
I agree with Dani that we should update the guidelines. Being restrictive by default makes sense, but only if everybody knows about the rules and plays by it. It seems to me that the "crowd" has decided to not play by these rules.

So, +1 for keeping the tags as they are, but also +1 for updating the guidelines.
Comment 8 Jim des Rivieres CLA 2008-04-07 10:25:30 EDT
+1 on updating the guidelines.

I think we should encourage people writing Javadoc to always be explicit, rather than rely on some global default rule that the reader might or might not know about. But clearly we can't require them to do so at this point.
Comment 9 Dani Megert CLA 2008-04-07 10:43:27 EDT
Maybe the updated doc can say that if a project uses API tooling (tags) then those tags describes the API contract. The problem is if  no tags are found: how can a client know that API tooling was used but there's no restriction?
Comment 10 Markus Keller CLA 2008-04-16 13:18:32 EDT
Reopening so that those who promote breakage of the original API rules don't forget to update the rules in public.
Comment 11 Boris Bokowski CLA 2008-04-16 16:39:58 EDT
Assigning to me. I spent some time with Jim on Friday on this, but I haven't found the time to make the actual updates to the document.

Markus, are you saying that JDT UI relied on the guidelines, i.e. do you have public classes that you do not consider subclassable but the Javadoc does not state that restriction explicitly?
Comment 12 Markus Keller CLA 2008-04-17 06:13:35 EDT
(In reply to comment #11)
> Markus, are you saying that JDT UI relied on the guidelines, i.e. do you have
> public classes that you do not consider subclassable but the Javadoc does not
> state that restriction explicitly?

No, at a quick glance, I didn't find any problems with classes.

But most API methods don't have an explicit statement whether they're intended to be overridden/extended/re-implemented. Up to now, my view was that the cited document sets the default, i.e. methods without explicit comments are not to be overridden. However, I have been told that some projects already didn't follow these rules, so we are in a somewhat undefined state right now.

With the advent of API Tooling, it becomes important to have clearly specified rules. We have to decide now how to proceed, otherwise the tooling will lock us into the liberal view (everything allowed if not forbidden) without any chance to escape. And the liberal view contradicts the API document.
Comment 13 Markus Schorn CLA 2008-12-19 10:04:23 EST
In addition to the existing tags (@noextend, ...) it would be nice to have the positive tags (@allowextend, ...). With that the API tooling could create a warning for entities that are not tagged.

--> This would force/encourage the developer to make a conscious decision rather than leaving the interpretation up to the API-tooling/guideline/reader
Comment 14 Andrew Gvozdev CLA 2010-02-08 17:29:19 EST
(In reply to comment #13)
> In addition to the existing tags (@noextend, ...) it would be nice to have the
> positive tags (@allowextend, ...). With that the API tooling could create a
> warning for entities that are not tagged.
> --> This would force/encourage the developer to make a conscious decision rather
> than leaving the interpretation up to the API-tooling/guideline/reader
It's been more than a year but API tooling would still benefit from it. +1 for this one.
Comment 15 Michael Rennie CLA 2013-04-19 12:09:54 EDT
With the fix for bug 235618 in, we need to decide exactly what the tags mean, how they should be used, their semantics and how they play with the API rules.
Comment 16 Eclipse Genie CLA 2019-09-11 12:55:55 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.

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