@Test @SuppressWarnings("FinalizeCalledExplicitly") public void testFinalize_whenNotMarkedAsDisposed() throws Throwable { ShadowCloseGuard.setUp(); mTransportClient.finalize(); assertThat(ShadowCloseGuard.hasReported()).isTrue(); }
@Override protected void finalize() throws Throwable { synchronized (mStateLock) { mCloseGuard.warnIfOpen(); if (mState >= State.BOUND_AND_CONNECTING) { String callerLogString = "TransportClient.finalize()"; log( Priority.ERROR, callerLogString, "Dangling TransportClient created in [" + mCreatorLogString + "] being " + "GC'ed. Left bound, unbinding..."); try { unbind(callerLogString); } catch (IllegalStateException e) { } } } }
TransportClient { @Override protected void finalize() throws Throwable { synchronized (mStateLock) { mCloseGuard.warnIfOpen(); if (mState >= State.BOUND_AND_CONNECTING) { String callerLogString = "TransportClient.finalize()"; log( Priority.ERROR, callerLogString, "Dangling TransportClient created in [" + mCreatorLogString + "] being " + "GC'ed. Left bound, unbinding..."); try { unbind(callerLogString); } catch (IllegalStateException e) { } } } } }
TransportClient { @Override protected void finalize() throws Throwable { synchronized (mStateLock) { mCloseGuard.warnIfOpen(); if (mState >= State.BOUND_AND_CONNECTING) { String callerLogString = "TransportClient.finalize()"; log( Priority.ERROR, callerLogString, "Dangling TransportClient created in [" + mCreatorLogString + "] being " + "GC'ed. Left bound, unbinding..."); try { unbind(callerLogString); } catch (IllegalStateException e) { } } } } TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller); @VisibleForTesting  TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller,
            Handler listenerHandler); }
TransportClient { @Override protected void finalize() throws Throwable { synchronized (mStateLock) { mCloseGuard.warnIfOpen(); if (mState >= State.BOUND_AND_CONNECTING) { String callerLogString = "TransportClient.finalize()"; log( Priority.ERROR, callerLogString, "Dangling TransportClient created in [" + mCreatorLogString + "] being " + "GC'ed. Left bound, unbinding..."); try { unbind(callerLogString); } catch (IllegalStateException e) { } } } } TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller); @VisibleForTesting  TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller,
            Handler listenerHandler); ComponentName getTransportComponent(); void connectAsync(TransportConnectionListener listener, String caller); void unbind(String caller); void markAsDisposed(); @WorkerThread @Nullable IBackupTransport connect(String caller); @WorkerThread IBackupTransport connectOrThrow(String caller); IBackupTransport getConnectedTransport(String caller); @Override String toString(); }
TransportClient { @Override protected void finalize() throws Throwable { synchronized (mStateLock) { mCloseGuard.warnIfOpen(); if (mState >= State.BOUND_AND_CONNECTING) { String callerLogString = "TransportClient.finalize()"; log( Priority.ERROR, callerLogString, "Dangling TransportClient created in [" + mCreatorLogString + "] being " + "GC'ed. Left bound, unbinding..."); try { unbind(callerLogString); } catch (IllegalStateException e) { } } } } TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller); @VisibleForTesting  TransportClient(
            Context context,
            TransportStats transportStats,
            Intent bindIntent,
            ComponentName transportComponent,
            String identifier,
            String caller,
            Handler listenerHandler); ComponentName getTransportComponent(); void connectAsync(TransportConnectionListener listener, String caller); void unbind(String caller); void markAsDisposed(); @WorkerThread @Nullable IBackupTransport connect(String caller); @WorkerThread IBackupTransport connectOrThrow(String caller); IBackupTransport getConnectedTransport(String caller); @Override String toString();  }