Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nonsensical deprecation for specifying listener priority #1491

Open
wants to merge 1 commit into
base: dev/3.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
*/
public enum PostOrder {

FIRST, EARLY, NORMAL, LATE, LAST, CUSTOM
FIRST, EARLY, NORMAL, LATE, LAST,

/**
* @deprecated No longer required, you only need to specify {@link Subscribe#priority()}.
*/
@Deprecated
CUSTOM

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
* The priority of this event handler. Priorities are used to determine the order in which event
* handlers are called. The higher the priority, the earlier the event handler will be called.
*
* <p>Note that due to compatibility constraints, you must specify {@link PostOrder#CUSTOM}
* in order to use this field.</p>
*
* @return the priority
*/
short priority() default Short.MIN_VALUE;
short priority() default 0;

/**
* Whether the handler must be called asynchronously. By default, all event handlers are called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ private void collectMethods(final Class<?> targetClass,
asyncType = AsyncType.ALWAYS;
}

// The default value of 0 will fall back to PostOrder, the default PostOrder (NORMAL) is also 0
final short order;
if (subscribe.order() == PostOrder.CUSTOM) {
if (subscribe.priority() != 0) {
order = subscribe.priority();
} else {
order = (short) POST_ORDER_MAP.get(subscribe.order());
Expand Down