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 40904 - Override annotations is not displayed
Summary: Override annotations is not displayed
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-10 16:36 UTC by ehucka
Modified: 2007-09-26 09:14 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Alternative fix to solve problem with Constructor comparator (3.45 KB, patch)
2004-03-11 12:19 UTC, Tomas Hurka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2004-03-10 16:36:20 UTC
Steps to reproduce:

1. create a class (e.g. A)
2. create two methods named e.g. methodA in this
class, the methods should have the same number of
parameters
3. create class B which extends class A
4. override both methods
5. open class B in editor

An override annotation is displayed before one
method only.
Comment 1 Jan Pokorsky 2004-03-10 16:51:07 UTC
Yes, there is a bug in comparators of source hierarchy.
Comment 2 Jan Pokorsky 2004-03-10 17:34:02 UTC
Constructor comparator must compare also parameter types.
Fixed in trunk

http://www.netbeans.org/source/browse/java/src/org/netbeans/api/java/comparators/ConstructorComparator.java.diff?r1=1.3&r2=1.4&f=c
http://www.netbeans.org/source/browse/java/src/org/netbeans/api/java/comparators/TypeComparator.java.diff?r1=1.3&r2=1.4&f=c

Tome, you are the original author. Could you review the fix please?
Comment 3 Jan Pokorsky 2004-03-10 17:35:01 UTC
I missed to CC Tomas as a reviewer.
Comment 4 Tomas Hurka 2004-03-11 12:17:20 UTC
I agree that the fix in TypeComparator is easy and correct.
The problem in ConstructorComparator should be fixed differently, since comparators 
should not have any defaults. The fix in revision 1.4 adds type comparation for parameters 
implicitly and there is no way to compare parameters only by its names (for example). I 
will attach diff of the fix I think is correct. 
Comment 5 Tomas Hurka 2004-03-11 12:19:14 UTC
Created attachment 13941 [details]
Alternative fix to solve problem with Constructor comparator
Comment 6 Jan Pokorsky 2004-03-11 12:39:54 UTC
OK, there is no javadoc so it is hard to estimate meaning of some part
of the api ;-) Since the api is private I see no reason why to not
change it as Tomas suggested even now.

Question: what is JavaElementComparator.PARAMETERS good for now? IMO
it should be defined as PARAM_MODIFIERS|PARAM_TYPE|PARAM_NAME or
thrown away at all.
JavaElementComparator.PARAMETERS|JavaElementComparator.PARAM_TYPE
looks useless.

Comment 7 Jan Pokorsky 2004-03-11 13:13:52 UTC
the patch integrated in trunk:
/cvs/java/src/org/netbeans/modules/java/OverrideAnnotationSupport.java,v1.2
/cvs/java/src/org/netbeans/api/java/comparators/ConstructorComparator.java,v1.5
/cvs/java/src/org/netbeans/api/java/comparators/JavaElementComparator.java,v1.7
Comment 8 Tomas Hurka 2004-03-11 13:24:55 UTC
JavaElementComparator.PARAMETERS means that you want to compare parameters. 
Different types with PARAM_ defines how the parameters are compared. 
JavaElementComparator.PARAMETERS without any PARAM_ is no-op. It is possible to 
remove JavaElementComparator.PARAMETERS and any PARAM_ means that you want to 
compare parameters.
Comment 9 Jesse Glick 2004-03-11 17:33:23 UTC
Note that this is an API change in an official API module and as such
should be marked in apichanges, etc.
Comment 10 Jan Pokorsky 2004-03-11 17:56:54 UTC
I cannot agree. It is private code nowhere published as the api. Even
java/manifest.mf does not declare it as a public package and the arch
document does not mention it too. I have no idea why it is under api
package of java module.
Comment 11 Jesse Glick 2004-03-11 18:14:13 UTC
You are right that it is not published as a stable API. (I don't
remember why this API was created.)

However the fact that java/manifest.mf lists *no*
OpenIDE-Module-Public-Packages means that *all* packages in java.jar
are open to public access, and since this is in an accessible
org.netbeans.[as]pi.** package, it is in an anomalous situation which
should be resolved somehow.
Comment 12 Jan Pokorsky 2004-03-11 18:43:09 UTC
True, but then we would have to log every change in whatever public
class of java module. Why just [as]pi.**? The best would be to use
"OpenIDE-Module-Public-Packages: -" but it is impossible now.

Since there is no javadoc, no tests for that code I do not want to
solve it as part of this issue. I would propose to file a task for
promo-D where we can decide about future of the code (move it under
org.netbeans.modules.java.comparators or org.openide.src.comparators
or some separate module). BTW I remember that comparators were removed
at all once before within prj40_prototype.
Comment 13 Jan Pokorsky 2004-03-11 18:57:37 UTC
Moreover the source hierarchy api is going to be deprecated and
replaced with JMI in promo-D so these comparators will be removed anyway.
Comment 14 Jaroslav Tulach 2004-03-12 08:26:25 UTC
According to 
http://openide.netbeans.org/tutorial/api-design.html#category-official
the org.netbeans.api.java.comparators is stable. According to 
http://www.netbeans.org/servlets/ReadMsg?msgId=714818&listName=api-changes
there was a change in the API.

If you are saying that the API is not documented, then we have found a
major bug. Bug 40945.

Also remember that when doing changes in APIs you should follow
http://openide.netbeans.org/tutorial/review-steps.html, which you have
apperently forgot in this case.
Comment 15 Jan Pokorsky 2004-03-12 13:42:55 UTC
OK, so to not let the code broken in release36 I merged the fix. 

integrated to release36:
/cvs/java/src/org/netbeans/modules/java/OverrideAnnotationSupport.java,v1.1.4.1
/cvs/java/src/org/netbeans/api/java/comparators/ConstructorComparator.java,v1.3.220.1
/cvs/java/src/org/netbeans/api/java/comparators/JavaElementComparator.java,v1.6.108.1
/cvs/java/src/org/netbeans/api/java/comparators/TypeComparator.java,v1.3.220.1
Comment 16 ehucka 2004-08-17 16:28:18 UTC
verified