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.
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.
Yes, there is a bug in comparators of source hierarchy.
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?
I missed to CC Tomas as a reviewer.
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.
Created attachment 13941 [details] Alternative fix to solve problem with Constructor comparator
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.
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
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.
Note that this is an API change in an official API module and as such should be marked in apichanges, etc.
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.
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.
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.
Moreover the source hierarchy api is going to be deprecated and replaced with JMI in promo-D so these comparators will be removed anyway.
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.
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
verified