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 199823 - @EditorActionRegistration in editor module overrides registrations from editor.lib w/o weight attr
Summary: @EditorActionRegistration in editor module overrides registrations from edito...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords: API, API_REVIEW_FAST
Depends on: 141925
Blocks: 150875 204686
  Show dependency tree
 
Reported: 2011-07-01 14:12 UTC by Jesse Glick
Modified: 2011-11-17 07:29 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed diff (6.26 KB, patch)
2011-11-13 23:16 UTC, Miloslav Metelka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-07-01 14:12:31 UTC
After 0081ad9a40cf, ValidateLayerConsistencyTest.testLayerOverrides began failing due to Editors/Actions/build-*.instance which are provided by both editor and editor.lib. Is this really intentional?

If not, remove the two @EditorActionRegistration's from editor.lib.

If it is intentional (e.g. so that the actions will be defined in an app including editor.lib but not editor), please consider adding an 'int weight() default 0' to EditorActionRegistration producing a 'weight' file attribute (see bug #141925) when defined, so that the editor version can clearly override the editor.lib version without considering layer load order.

Or the annotation processor could hardcode the weight attribute in this case; or even figure out that the registration in editor was an override based on the fact that NbBuildPopupMenuAction extends BuildPopupMenuAction and the superclass is also annotated with the same key.
Comment 1 Jesse Glick 2011-07-01 14:12:54 UTC
174a04b221c1 is the current workaround in the test, by the way.
Comment 2 Miloslav Metelka 2011-10-18 13:46:51 UTC
I'll add the weight attribute into the @EditorActionRegistration. Thanks.
Comment 3 Jesse Glick 2011-11-01 21:33:41 UTC
Do not forget to revert 174a04b221c1 when fixing.
Comment 4 Miloslav Metelka 2011-11-13 23:16:32 UTC
Created attachment 113170 [details]
Proposed diff
Comment 5 Miloslav Metelka 2011-11-13 23:34:43 UTC
Diff adds the weight attribute to @EditorActionRegistration. I have reverted 174a04b221c1 and uncommented NbBuildPopupAction in NbEditorKit and the test failed. After adding weight attribute the test passed.
Jesse, are there any guidelines for the weight attribute values? I have used weight = 100 in NbEditorKit.
Since EditorActionRegistration is API I request a fasttrack review. Thanks.
Comment 6 Jesse Glick 2011-11-14 14:55:54 UTC
[JG01] Typo "ommited"


[JG02] Do not link to "http://bits.netbeans.org/6.9/javadoc/". Use "@TOP@/" instead. But anyway there is no need to link to apichanges because the mechanism is covered in Javadoc proper; use {@link org.openide.filesystems.MultiFileSystem}.


[JG03] Check build-popup-menu.instance which suffered from the same problem, at least when I worked around it in ValidateLayerConsistencyTest.


(In reply to comment #5)
> are there any guidelines for the weight attribute values?

Nothing in particular, this patch looks OK to me.
Comment 7 Miloslav Metelka 2011-11-15 22:55:50 UTC
Thanks, Jesse.
http://hg.netbeans.org/jet-main/rev/4dbcb49c751c
Comment 8 Jesse Glick 2011-11-16 13:57:52 UTC
One minor thing I forgot to mention before:


[JG04] The natural default value for weight is 0, not MIN_VALUE: you can make files "recessive" by giving them negative weights just as they can be "dominant" with positive weights, and <attr name="weight" intvalue="0"/> is a no-op. Thus I would recommend

int weight() default 0;

and having the processor check

if (weight != 0) ...
Comment 9 Miloslav Metelka 2011-11-16 18:31:51 UTC
default weight is now 0. Thanks.

http://hg.netbeans.org/jet-main/rev/942e801cbb4f
Comment 10 Quality Engineering 2011-11-17 07:29:17 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/4dbcb49c751c
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #199823 - @EditorActionRegistration in editor module overrides registrations from editor.lib w/o weight attr.