Buggy code:
final class HandlerAuthority extends ExpressionAuthority { private static final int ACTIVATIONS_BY_SOURCE_SIZE = 256 ; private static final int ACTIVATIONS_TO_RECOMPUTE_SIZE = 1024 ; private static final boolean DEBUG = Policy . DEBUG_HANDLERS ; private static final boolean DEBUG_PERFORMANCE = Policy . DEBUG_HANDLERS_PERFORMANCE ; private static final boolean DEBUG_VERBOSE = ( Policy . DEBUG_HANDLERS ) && ( Policy . DEBUG_HANDLERS_VERBOSE ) ; private static final String DEBUG_VERBOSE_COMMAND_ID = Policy . DEBUG_HANDLERS_VERBOSE_COMMAND_ID ; private static final String TRACING_COMPONENT = "HANDLERS" ; private final Map [ ] activationsByExpressionBySourcePriority = new Map [ 33 ] ; private final ICommandService commandService ; private final Map handlerActivationsByCommandId = new HashMap ( ) ; HandlerAuthority ( final ICommandService commandService ) { } final void activateHandler ( final IHandlerActivation activation ) { } final void deactivateHandler ( final IHandlerActivation activation ) { } final Shell getActiveShell ( ) { } private final IHandlerActivation resolveConflicts ( final String commandId , final SortedSet activations ) { if ( activations . isEmpty ( ) ) { return null ; } final Iterator activationItr = activations . iterator ( ) ; IHandlerActivation bestActivation = null ; boolean conflict = false ; while ( activationItr . hasNext ( ) ) { final IHandlerActivation currentActivation = ( ( IHandlerActivation ) ( activationItr . next ( ) ) ) ; if ( ! ( evaluate ( currentActivation ) ) ) { continue ; } if ( ( HandlerAuthority . DEBUG_VERBOSE ) && ( ( ( HandlerAuthority . DEBUG_VERBOSE_COMMAND_ID ) == null ) || ( HandlerAuthority . DEBUG_VERBOSE_COMMAND_ID . equals ( commandId ) ) ) ) { Tracing . printTrace ( HandlerAuthority . TRACING_COMPONENT , ( "<seq2seq4repair_space>resolveConflicts:<seq2seq4repair_space>eval:<seq2seq4repair_space>" + currentActivation ) ) ; } if ( bestActivation == null ) { bestActivation = currentActivation ; conflict = false ; continue ; } final int comparison = bestActivation . compareTo ( currentActivation ) ; <START_BUG> if ( comparison > 0 ) { <END_BUG> bestActivation = currentActivation ; conflict = false ; } else if ( comparison == 0 ) { if ( ( currentActivation . getHandler ( ) ) != ( bestActivation . getHandler ( ) ) ) { conflict = true ; } } else { break ; } } if ( HandlerAuthority . DEBUG ) { if ( conflict ) { Tracing . printTrace ( HandlerAuthority . TRACING_COMPONENT , ( ( "Unresolved<seq2seq4repair_space>conflict<seq2seq4repair_space>detected<seq2seq4repair_space>for<seq2seq4repair_space>'" + commandId ) + '\'' ) ) ; } else if ( ( ( bestActivation != null ) && ( HandlerAuthority . DEBUG_VERBOSE ) ) && ( ( ( HandlerAuthority . DEBUG_VERBOSE_COMMAND_ID ) == null ) || ( HandlerAuthority . DEBUG_VERBOSE_COMMAND_ID . equals ( commandId ) ) ) ) { Tracing . printTrace ( HandlerAuthority . TRACING_COMPONENT , "Resolved<seq2seq4repair_space>conflict<seq2seq4repair_space>detected.<seq2seq4repair_space>The<seq2seq4repair_space>following<seq2seq4repair_space>activation<seq2seq4repair_space>won:<seq2seq4repair_space>" ) ; Tracing . printTrace ( HandlerAuthority . TRACING_COMPONENT , ( "<seq2seq4repair_space>" + bestActivation ) ) ; } } if ( conflict ) { return null ; } return bestActivation ; } protected final void sourceChanged ( final int sourcePriority ) { } private final void updateCommand ( final String commandId , final IHandlerActivation activation ) { } final void updateShellKludge ( ) { } }

Fix:
if ( comparison < 0 ) {