Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 206093 - Need explicit marker for eager action registration
Need explicit marker for eager action registration
Product: platform
Classification: Unclassified
Component: Actions
All All
: P3 (vote)
: 7.2
Assigned To: Jesse Glick
Depends on:
Blocks: 183794 206089
  Show dependency treegraph
Reported: 2011-12-07 15:28 UTC by Jesse Glick
Modified: 2011-12-15 12:45 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT

Proposed patch (43.67 KB, patch)
2011-12-07 18:30 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-12-07 15:28:37 UTC
Continuation of JG04 from bug #183794. In practice there are some actions which simply cannot be registered using lazy factories, and convincing the action processor to use a traditional eager registration for them is cumbersome and error-prone: you have to know to implement a special interface like ContextAwareAction and then somehow implement it without changing semantics.

While my original preference was for a separate annotation for such actions, an attribute lazy=false (with default being true) in @ActionRegistration would suffice. When lazy=false, the processor would create a traditional registration rather than using an Actions factory method.

Attempting to use lazy=false would result in an error when only a factory method could make sense, e.g. the class implements only ActionListener and not Action, or it has a context constructor.

For compatibility, existing (implicitly lazy=true) registrations on classes which implement ContextAwareAction, Presenter.*, or DynamicMenuContent would continue to processed as eager, but a warning should be issued. (To use a lazy factory, specify lazy=true explicitly; the processor can use AnnotationMirror.getElementValues to distinguish this case. Of course such registrations will not generally work as intended, but there might be reasons to do it.)
Comment 1 Jesse Glick 2011-12-07 18:30:12 UTC
Created attachment 113935 [details]
Proposed patch

Includes API and processor impl; and updates to various existing registrations to specify lazy=false (in some cases removing dummy implementations of marker interfaces which existed solely to force this style).
Comment 2 Jesse Glick 2011-12-07 18:30:53 UTC
Please review.
Comment 3 Jesse Glick 2011-12-07 18:40:04 UTC
Will also add apichanges.xml entry of course.
Comment 4 Jesse Glick 2011-12-14 17:01:13 UTC
core-main #316ede293415
Comment 5 Quality Engineering 2011-12-15 12:45:01 UTC
Integrated into 'main-golden'
User: Jesse Glick <>
Log: #206093: allow an @ActionRegistration to be explicitly marked lazy or eager.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo