Buggy code:
public abstract class Manager < U extends IHowToGetHandle , V extends Handle > implements IDestroyable { static long getTimeOut ( Long possibleTimeOut ) { } final Awaiting awaiting ; private final WebDriverEncapsulation driverEncapsulation ; boolean isAlive = true ; private final HandleReceptionist handleReceptionist = new HandleReceptionist ( ) ; private static final Map < WebDriverEncapsulation , Manager < ? , ? > > managerMap = Collections . synchronizedMap ( new HashMap < WebDriverEncapsulation , Manager < ? , ? > > ( ) ) ; static final long defaultTimeOut = 5 ; private String STUB_HANDLE = "STUB" ; private String currentHandle ; @ SuppressWarnings ( "unchecked" ) public static < T extends Manager < ? , ? > > T getInstanstiatedManager ( WebDriverEncapsulation driverEncapsulation ) { } Manager ( WebDriverEncapsulation initialDriverEncapsulation ) { } abstract void changeActive ( String handle ) { } @ Override public void destroy ( ) { } public Alert getAlert ( ) throws NoAlertPresentException { } public synchronized Alert getAlert ( long timeOut ) throws NoAlertPresentException { } @ SuppressWarnings ( "unchecked" ) private U returnRelevantHowToGetStrategy ( ) { } public V getHandle ( int index ) { } public V getHandle ( int index , long timeOut ) { } public V getHandle ( int index , By by , long timeOut ) { } public V getHandle ( int index , By by ) { } public V getHandle ( int index , HowToGetByFrames howToGetByFramesStrategy , long timeOut ) { } public V getHandle ( int index , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( int index , By by , HowToGetByFrames howToGetByFramesStrategy , long timeOut ) { } public V getHandle ( int index , By by , HowToGetByFrames howToGetByFramesStrategy ) { } HandleReceptionist getHandleReceptionist ( ) { } abstract Set < String > getHandles ( ) { } @ SuppressWarnings ( "unchecked" ) private V createProxy ( long timeOut , U howToGet , By by , HowToGetByFrames howToGetByFramesStrategy ) { } @ SuppressWarnings ( "unchecked" ) public V getHandle ( V parent , By by , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( V parent , By by ) { } public V getHandle ( V parent , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( long timeOut , U howToGet , By by , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( U howToGet , By by , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( long timeOut , U howToGet , By by ) { } public V getHandle ( U howToGet , By by ) { } public V getHandle ( long timeOut , U howToGet , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( U howToGet , HowToGetByFrames howToGetByFramesStrategy ) { } public V getHandle ( long timeOut , U howToGet ) { } public V getHandle ( U howToGet ) { } abstract V getRealHandle ( long timeOut , U howToGet , By by , HowToGetByFrames howToGetByFramesStrategy ) { } WebDriverEncapsulation getWebDriverEncapsulation ( ) { } WebDriver getWrappedDriver ( ) { } boolean isAlive ( ) { } synchronized void switchTo ( String handle ) { <START_BUG> if ( handle . equals ( currentHandle ) ) <END_BUG> changeActive ( handle ) ; } abstract String getStringHandle ( long timeOut , U howToGet ) { } @ SuppressWarnings ( "unchecked" ) < T extends Handle > T returnNewCreatedListenableHandle ( Handle handle , String beanName ) { } HandleWaitingTimeOut getHandleWaitingTimeOut ( ) { } }

Fix:
if ( ! ( handle . equals ( currentHandle ) ) )