Buggy code:
public class CommonResourceResolverFactoryImpl implements ResourceResolverFactory , MapConfigurationProvider { private MapEntries mapEntries = MapEntries . EMPTY ; private ResourceResolverWebConsolePlugin plugin ; private final ResourceResolverFactoryActivator activator ; private ThreadLocal < Stack < WeakReference < ResourceResolver > > > resolverStackHolder = new ThreadLocal < Stack < WeakReference < ResourceResolver > > > ( ) ; private final AtomicBoolean isActive = new AtomicBoolean ( true ) ; private final ReferenceQueue < ResourceResolver > resolverReferenceQueue = new ReferenceQueue < ResourceResolver > ( ) ; private final Set < CommonResourceResolverFactoryImpl . ResolverWeakReference > refs = new ConcurrentSkipListSet < CommonResourceResolverFactoryImpl . ResolverWeakReference > ( ) ; private final Thread refQueueThread ; public CommonResourceResolverFactoryImpl ( final ResourceResolverFactoryActivator activator ) { } public ResourceResolver getAdministrativeResourceResolver ( final Map < String , Object > passedAuthenticationInfo ) throws LoginException { } public ResourceResolver getResourceResolver ( final Map < String , Object > passedAuthenticationInfo ) throws LoginException { } public ResourceResolver getThreadResourceResolver ( ) { } public void closed ( final ResourceResolverImpl resourceResolverImpl ) { } public ResourceResolver getResourceResolverInternal ( final Map < String , Object > authenticationInfo , final boolean isAdmin ) throws LoginException { } public MapEntries getMapEntries ( ) { } protected void activate ( final BundleContext bundleContext ) { } protected void deactivate ( ) { } public ResourceDecoratorTracker getResourceDecoratorTracker ( ) { } public String [ ] getSearchPath ( ) { } public boolean isMangleNamespacePrefixes ( ) { } public String getMapRoot ( ) { } public Mapping [ ] getMappings ( ) { } public BidiMap getVirtualURLMap ( ) { } public RootResourceProviderEntry getRootProviderEntry ( ) { } public int getDefaultVanityPathRedirectStatus ( ) { } public ResourceAccessSecurityTracker getResourceAccessSecurityTracker ( ) { } public ResourceResolver getServiceResourceResolver ( final Map < String , Object > authenticationInfo ) throws LoginException { } public boolean isVanityPathEnabled ( ) { } public long getMaxCachedVanityPathEntries ( ) { } public int getVanityBloomFilterMaxBytes ( ) { } public boolean isOptimizeAliasResolutionEnabled ( ) { } public boolean hasVanityPathPrecedence ( ) { } public List < VanityPathConfig > getVanityPathConfig ( ) { } public boolean isLive ( ) { } public void addToFinalizeList ( final ResourceResolver resolver , final ResourceResolverContext ctx ) { } private static final class ResolverWeakReference extends WeakReference < ResourceResolver > implements Comparable < CommonResourceResolverFactoryImpl . ResolverWeakReference > { private final ResourceResolverContext context ; public ResolverWeakReference ( final ResourceResolver referent , final ReferenceQueue < ? super ResourceResolver > q , final ResourceResolverContext ctx ) { } public void close ( ) { } public int compareTo ( final CommonResourceResolverFactoryImpl . ResolverWeakReference o ) { <START_BUG> return ( context . hashCode ( ) ) - ( o . hashCode ( ) ) ; <END_BUG> } } No newline ; at end ; of file ; }

Fix:
return ( context . hashCode ( ) ) - ( o . context . hashCode ( ) ) ;