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.

Bug 26913 - Eliminate use of Node.Cookie
Summary: Eliminate use of Node.Cookie
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: API
Depends on: 26790
Blocks:
  Show dependency tree
 
Reported: 2002-08-30 09:56 UTC by Jaroslav Tulach
Modified: 2003-12-11 14:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2002-08-30 09:56:09 UTC
I have noticed many uses of Node.Cookie which
would better be avaided. So I have filed this bug,
but it can be easily closed if you feel that it is
complete nonsence.

Instead of letting many of your classes and
interfaces implement Node.Cookie create one marked
interface ProjectCookie or ProjectFeature, etc.
that extends Node.Cookie and all other classes
that right now extends Node.Cookie would inherit
from ProjectFeature.

There are two advantages. First of all it is
possible to find out all cookies in project. Just
by asking for all subinterfaces of your interface.
Also it easier to eliminate the Node.Cookie in
future, it is mentioned just in one class, to the
patching is less complicated.
Comment 1 Vitezslav Stejskal 2002-08-30 10:59:00 UTC
Good point, Node.Cookie is used in classes which we need to return
from getCookie methods. Do you think that ProjectFeature interface
could be non-public part of API, then we could simply remove it after
some time when we will support backward compatibility by patching.
Comment 2 Jaroslav Tulach 2002-09-02 12:55:25 UTC
I am not sure if "non-public" part of the API is the best, I hate API
that refers to non-public classes, but I've got an idea: We could use
bytecode patching for this purpose. 

class ProjectCookie implements Node.Cookie {
}

would be the nonpublic API and for example:

public class ProjectDescriptor extends Object 

would be patched to extend ProjectCookie instead of Object. That way
you could return the instance from getCookie and nobody could rely on
it to implement the Node.Cookie

Please see openide/build.xml for a syntax for patching


PS: Not sure if all your uses of Node.Cookie are from abstract classes
or if there is also a use from interfaces. If the later, I would have
to improve the patching to alter not just superclass but also
superinterfaces.



Comment 3 Vitezslav Stejskal 2002-09-02 13:39:07 UTC
Sounds good, I'll do it.
Comment 4 Vitezslav Stejskal 2002-10-15 15:26:30 UTC
Done. The Node.Cookie has been removed from projects public API,
classe which implemented Node.Cookie are patched in runtime to
implement this tagging interface so they still can be obtained from
Node.getCookie method.

If I understand it correctly this will not be neccasary when new
Actions and Datasystems API will be done (cookies will be replaced by
Lookup).

The BuildTargetDependency interface still extends Node.Cookie since
runtime patching doesn't work yet for interfaces (see issue #28022).
This interface will be moved to projects/compilation module anyway and
it doesn't affect projects core API, so I am closing this issue.
Comment 5 Jaroslav Tulach 2003-07-14 15:31:51 UTC
Node.Cookie is gone as far as I know.
Comment 6 Jan Becicka 2003-11-25 14:18:55 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.

Marking issue as CLOSED.