diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvation.ml index ded867c56..53b6b7594 100644 --- a/infer/src/concurrency/starvation.ml +++ b/infer/src/concurrency/starvation.ml @@ -261,15 +261,18 @@ end = struct } in let log_reports compare loc reports issue_log = - match reports with - | [] -> - issue_log - | [(_, report)] -> - log_report ~issue_log loc report - | reports -> - List.max_elt ~compare reports - |> Option.fold ~init:issue_log ~f:(fun acc (_, rep) -> - mk_deduped_report rep |> log_report ~issue_log:acc loc ) + if Config.deduplicate then + match reports with + | [] -> + issue_log + | [(_, report)] -> + log_report ~issue_log loc report + | reports -> + List.max_elt ~compare reports + |> Option.fold ~init:issue_log ~f:(fun acc (_, rep) -> + mk_deduped_report rep |> log_report ~issue_log:acc loc ) + else + List.fold reports ~init:issue_log ~f:(fun acc (_, rep) -> log_report ~issue_log:acc loc rep) in let filter_map_deadlock = function {problem= Deadlock l} as r -> Some (l, r) | _ -> None in let filter_map_starvation = function @@ -307,6 +310,8 @@ end = struct end let should_report_deadlock_on_current_proc current_elem endpoint_elem = + (not Config.deduplicate) + || let open StarvationDomain in match (current_elem.Order.elem.first, current_elem.Order.elem.eventually.elem) with | _, (MayBlock _ | StrictModeCall _) -> diff --git a/infer/tests/codetoanalyze/cpp/starvation/issues.exp b/infer/tests/codetoanalyze/cpp/starvation/issues.exp index 242c8795f..bca150e38 100644 --- a/infer/tests/codetoanalyze/cpp/starvation/issues.exp +++ b/infer/tests/codetoanalyze/cpp/starvation/issues.exp @@ -1,9 +1,11 @@ codetoanalyze/cpp/starvation/basics.cpp, basics::Basic::thread1_bad, 18, DEADLOCK, no_bucket, ERROR, [[Trace 1] `basics::Basic::thread1_bad`, locks `this.mutex_1` in `class basics::Basic`, locks `this.mutex_2` in `class basics::Basic`,[Trace 2] `basics::Basic::thread2_bad`, locks `this.mutex_2` in `class basics::Basic`, locks `this.mutex_1` in `class basics::Basic`] +codetoanalyze/cpp/starvation/basics.cpp, basics::Basic::thread2_bad, 26, DEADLOCK, no_bucket, ERROR, [[Trace 1] `basics::Basic::thread2_bad`, locks `this.mutex_2` in `class basics::Basic`, locks `this.mutex_1` in `class basics::Basic`,[Trace 2] `basics::Basic::thread1_bad`, locks `this.mutex_1` in `class basics::Basic`, locks `this.mutex_2` in `class basics::Basic`] codetoanalyze/cpp/starvation/basics.cpp, basics::PathSensitive::FP_ok, 142, DEADLOCK, no_bucket, ERROR, [In method `basics::PathSensitive::FP_ok`, locks `this.mutex_` in `class basics::PathSensitive`, locks `this.mutex_` in `class basics::PathSensitive`] codetoanalyze/cpp/starvation/basics.cpp, basics::SelfDeadlock::complicated_bad, 131, DEADLOCK, no_bucket, ERROR, [In method `basics::SelfDeadlock::complicated_bad`, locks `this.mutex_` in `class basics::SelfDeadlock`, locks `this.mutex_` in `class basics::SelfDeadlock`] codetoanalyze/cpp/starvation/basics.cpp, basics::SelfDeadlock::interproc1_bad, 114, DEADLOCK, no_bucket, ERROR, [In method `basics::SelfDeadlock::interproc1_bad`, locks `this.mutex_` in `class basics::SelfDeadlock`,Method call: `basics::SelfDeadlock::interproc2_bad`, locks `this.mutex_` in `class basics::SelfDeadlock`] codetoanalyze/cpp/starvation/basics.cpp, basics::SelfDeadlock::thread_bad, 105, DEADLOCK, no_bucket, ERROR, [In method `basics::SelfDeadlock::thread_bad`, locks `this.mutex_` in `class basics::SelfDeadlock`, locks `this.mutex_` in `class basics::SelfDeadlock`] codetoanalyze/cpp/starvation/basics.cpp, basics::WithGuard::thread1_bad, 44, DEADLOCK, no_bucket, ERROR, [[Trace 1] `basics::WithGuard::thread1_bad`, locks `this.mutex_1` in `class basics::WithGuard`, locks `this.mutex_2` in `class basics::WithGuard`,[Trace 2] `basics::WithGuard::thread2_bad`, locks `this.mutex_2` in `class basics::WithGuard`, locks `this.mutex_1` in `class basics::WithGuard`] +codetoanalyze/cpp/starvation/basics.cpp, basics::WithGuard::thread2_bad, 49, DEADLOCK, no_bucket, ERROR, [[Trace 1] `basics::WithGuard::thread2_bad`, locks `this.mutex_2` in `class basics::WithGuard`, locks `this.mutex_1` in `class basics::WithGuard`,[Trace 2] `basics::WithGuard::thread1_bad`, locks `this.mutex_1` in `class basics::WithGuard`, locks `this.mutex_2` in `class basics::WithGuard`] codetoanalyze/cpp/starvation/skip.cpp, skipped::Skip::not_skipped_bad, 19, DEADLOCK, no_bucket, ERROR, [In method `skipped::Skip::not_skipped_bad`,Method call: `skipped::Skip::private_deadlock`, locks `this.mutex_` in `class skipped::Skip`, locks `this.mutex_` in `class skipped::Skip`] codetoanalyze/cpp/starvation/skip.cpp, skipped::SkipTemplate::not_skipped_bad, 44, DEADLOCK, no_bucket, ERROR, [In method `skipped::SkipTemplate::not_skipped_bad`,Method call: `skipped::SkipTemplate::private_deadlock`, locks `this.mutex_` in `class skipped::SkipTemplate`, locks `this.mutex_` in `class skipped::SkipTemplate`] codetoanalyze/cpp/starvation/skip.cpp, skipped::UseTemplate::foo, 53, DEADLOCK, no_bucket, ERROR, [In method `skipped::UseTemplate::foo`,Method call: `skipped::SkipTemplate::not_skipped_bad`,Method call: `skipped::SkipTemplate::private_deadlock`, locks `this.mutex_` in `class skipped::SkipTemplate`, locks `this.mutex_` in `class skipped::SkipTemplate`] diff --git a/infer/tests/codetoanalyze/java/starvation/Dedup.java b/infer/tests/codetoanalyze/java/starvation-dedup/Dedup.java similarity index 100% rename from infer/tests/codetoanalyze/java/starvation/Dedup.java rename to infer/tests/codetoanalyze/java/starvation-dedup/Dedup.java diff --git a/infer/tests/codetoanalyze/java/starvation-dedup/Interproc.java b/infer/tests/codetoanalyze/java/starvation-dedup/Interproc.java new file mode 100644 index 000000000..fbb81fc8e --- /dev/null +++ b/infer/tests/codetoanalyze/java/starvation-dedup/Interproc.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class Interproc { + synchronized void interproc1Bad(InterprocA a) { + interproc2Bad(a); + } + + void interproc2Bad(InterprocA b) { + synchronized (b) { + } + } + + synchronized void interproc1Ok(InterprocB a) { + interproc2Ok(a); + } + + void interproc2Ok(InterprocB b) { + synchronized (b) { + } + } + + void reentrant1Ok(InterprocB b) { + synchronized (this) { + synchronized (b) { + reentrant2Ok(); + } + } + } + + synchronized void reentrant2Ok() {} +} + +class InterprocA { + synchronized void FN_interproc1Bad(Interproc c) { + interproc2Bad(c); + } + + void interproc2Bad(Interproc d) { + synchronized (d) { + } + } +} + +class InterprocB { + void interproc1Ok(Interproc c) { + synchronized (c) { + interproc2Ok(c); + } + } + + synchronized void interproc2Ok(Interproc d) {} +} diff --git a/infer/tests/codetoanalyze/java/starvation-dedup/Intraproc.java b/infer/tests/codetoanalyze/java/starvation-dedup/Intraproc.java new file mode 100644 index 000000000..b09d8959a --- /dev/null +++ b/infer/tests/codetoanalyze/java/starvation-dedup/Intraproc.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +class Intraproc { + void intraBad(IntraprocA o) { + synchronized (this) { + synchronized (o) { + } + } + } + + void intraOk(IntraprocB o) { + synchronized (this) { + synchronized (o) { + } + } + } + + void reentrantOk(IntraprocB b) { + synchronized (this) { + synchronized (b) { + synchronized (this) { + } + } + } + } +} + +class IntraprocA { + void FN_intraBad(Intraproc o) { + synchronized (this) { + synchronized (o) { + } + } + } +} + +class IntraprocB { + void intraOk(Intraproc o) { + synchronized (o) { + synchronized (this) { + } + } + } +} diff --git a/infer/tests/codetoanalyze/java/starvation-dedup/Makefile b/infer/tests/codetoanalyze/java/starvation-dedup/Makefile new file mode 100644 index 000000000..b36bfa326 --- /dev/null +++ b/infer/tests/codetoanalyze/java/starvation-dedup/Makefile @@ -0,0 +1,12 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +TESTS_DIR = ../../.. + +INFER_OPTIONS = --starvation-only +INFERPRINT_OPTIONS = --issues-tests +SOURCES = $(wildcard *.java) + +include $(TESTS_DIR)/javac.make diff --git a/infer/tests/codetoanalyze/java/starvation-dedup/issues.exp b/infer/tests/codetoanalyze/java/starvation-dedup/issues.exp new file mode 100644 index 000000000..00f80805e --- /dev/null +++ b/infer/tests/codetoanalyze/java/starvation-dedup/issues.exp @@ -0,0 +1,5 @@ +codetoanalyze/java/starvation-dedup/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 26, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `Object Future.get()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] +codetoanalyze/java/starvation-dedup/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 27, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] +codetoanalyze/java/starvation-dedup/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 28, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `Object Future.get()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] +codetoanalyze/java/starvation-dedup/Dedup.java, Dedup.onUiThreadBad():void, 20, STARVATION, no_bucket, ERROR, [`void Dedup.onUiThreadBad()`,Method call: `void Dedup.callMethodWithMultipleBlocksBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Dedup.onUiThreadBad()`,`void Dedup.onUiThreadBad()` is annotated `UiThread`] +codetoanalyze/java/starvation-dedup/Dedup.java, Dedup.oneWayBad():void, 35, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Dedup.oneWayBad()`, locks `this.lockA` in `class Dedup`, locks `this.lockB` in `class Dedup`,[Trace 2] `void Dedup.anotherWayBad()`, locks `this.lockB` in `class Dedup`, locks `this.lockA` in `class Dedup`] diff --git a/infer/tests/codetoanalyze/java/starvation/AccMgr.java b/infer/tests/codetoanalyze/java/starvation/AccMgr.java deleted file mode 100644 index e41581e49..000000000 --- a/infer/tests/codetoanalyze/java/starvation/AccMgr.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import android.accounts.Account; -import android.accounts.AccountManager; -import android.support.annotation.UiThread; - -class AccMgr { - AccountManager am; - Account account; - String key, data; - Object lock; - - // not OK: setUserData may cause stalls, but the general belief is that it's rare - @UiThread - void onUiThreadOk() throws InterruptedException { - am.setUserData(account, key, data); - } - - // ditto - @UiThread - void lockOnUiThreadOk() throws InterruptedException { - synchronized (lock) { - } - } - - void setUserDataUnderLock() { - synchronized (lock) { - am.setUserData(account, key, data); - } - } - - void onOtherThreadOk() { - am.setUserData(account, key, data); - } -} diff --git a/infer/tests/codetoanalyze/java/starvation/issues.exp b/infer/tests/codetoanalyze/java/starvation/issues.exp index 60b3dddaa..7a5c268fe 100644 --- a/infer/tests/codetoanalyze/java/starvation/issues.exp +++ b/infer/tests/codetoanalyze/java/starvation/issues.exp @@ -5,11 +5,6 @@ codetoanalyze/java/starvation/Binders.java, Binders.interBad():void, 24, STARVAT codetoanalyze/java/starvation/Binders.java, Binders.intraBad():void, 30, STARVATION, no_bucket, ERROR, [`void Binders.intraBad()`,Method call: `void Binders.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void Binders.intraBad()`,it calls `void OurThreadUtils.assertMainThread()`] codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByAnnotBad():void, 21, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByAnnotBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Countdwn.awaitOnMainByAnnotBad()`,`void Countdwn.awaitOnMainByAnnotBad()` is annotated `UiThread`] codetoanalyze/java/starvation/Countdwn.java, Countdwn.awaitOnMainByCallBad():void, 16, STARVATION, no_bucket, ERROR, [`void Countdwn.awaitOnMainByCallBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Countdwn.awaitOnMainByCallBad()`,it calls `void OurThreadUtils.assertMainThread()`] -codetoanalyze/java/starvation/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 26, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `Object Future.get()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] -codetoanalyze/java/starvation/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 27, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] -codetoanalyze/java/starvation/Dedup.java, Dedup.callMethodWithMultipleBlocksBad():void, 28, STARVATION, no_bucket, ERROR, [`void Dedup.callMethodWithMultipleBlocksBad()`,calls `Object Future.get()`,[Trace on UI thread] `void Dedup.callMethodWithMultipleBlocksBad()`,`void Dedup.callMethodWithMultipleBlocksBad()` is annotated `UiThread`] -codetoanalyze/java/starvation/Dedup.java, Dedup.onUiThreadBad():void, 20, STARVATION, no_bucket, ERROR, [`void Dedup.onUiThreadBad()`,Method call: `void Dedup.callMethodWithMultipleBlocksBad()`,calls `void CountDownLatch.await()`,[Trace on UI thread] `void Dedup.onUiThreadBad()`,`void Dedup.onUiThreadBad()` is annotated `UiThread`] -codetoanalyze/java/starvation/Dedup.java, Dedup.oneWayBad():void, 35, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Dedup.oneWayBad()`, locks `this.lockA` in `class Dedup`, locks `this.lockB` in `class Dedup`,[Trace 2] `void Dedup.anotherWayBad()`, locks `this.lockB` in `class Dedup`, locks `this.lockA` in `class Dedup`] codetoanalyze/java/starvation/FutureGet.java, FutureGet.getDirectBad():void, 21, STARVATION, no_bucket, ERROR, [`void FutureGet.getDirectBad()`,calls `Object Future.get()`,[Trace on UI thread] `void FutureGet.getDirectBad()`,`void FutureGet.getDirectBad()` is annotated `UiThread`] codetoanalyze/java/starvation/FutureGet.java, FutureGet.getIndirectBad():void, 26, STARVATION, no_bucket, ERROR, [[Trace 1] `void FutureGet.getIndirectBad()`, locks `this.lock` in `class FutureGet`,[Trace 2] `void FutureGet.getUnderLock()`, locks `this.lock` in `class FutureGet`,calls `Object Future.get()`,[Trace 1 on UI thread] `void FutureGet.getIndirectBad()`,`void FutureGet.getIndirectBad()` is annotated `UiThread`] codetoanalyze/java/starvation/FutureGet.java, FutureGet.getTimeout50000001MicroSecondsBad():void, 83, STARVATION, no_bucket, ERROR, [`void FutureGet.getTimeout50000001MicroSecondsBad()`,calls `Object Future.get(long,TimeUnit)`,[Trace on UI thread] `void FutureGet.getTimeout50000001MicroSecondsBad()`,`void FutureGet.getTimeout50000001MicroSecondsBad()` is annotated `UiThread`] @@ -20,7 +15,10 @@ codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeExpensiveLoc codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc):void, 35, STARVATION, no_bucket, ERROR, [[Trace 1] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,Method call: `void IndirectInterproc.takeLock()`, locks `this` in `class IndirectInterproc`,[Trace 2] `void IndirectInterproc.doTransactUnderLock(Binder)`, locks `this` in `class IndirectInterproc`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace 1 on UI thread] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,`void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)` is annotated `UiThread`] codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.(InnerClass,java.lang.Object), 47, DEADLOCK, no_bucket, ERROR, [[Trace 1] `InnerClass$InnerClassA.(InnerClass,Object)`, locks `this` in `class InnerClass$InnerClassA`,Method call: `void InnerClass.bar()`, locks `this` in `class InnerClass`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`, locks `this` in `class InnerClass`,Method call: `void InnerClass$InnerClassA.baz()`, locks `this` in `class InnerClass$InnerClassA`] codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.innerOuterBad():void, 33, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InnerClass$InnerClassA.innerOuterBad()`, locks `this` in `class InnerClass$InnerClassA`,Method call: `void InnerClass.bar()`, locks `this` in `class InnerClass`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`, locks `this` in `class InnerClass`,Method call: `void InnerClass$InnerClassA.baz()`, locks `this` in `class InnerClass$InnerClassA`] +codetoanalyze/java/starvation/InnerClass.java, InnerClass.outerInnerBad(InnerClass$InnerClassA):void, 15, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`, locks `this` in `class InnerClass`,Method call: `void InnerClass$InnerClassA.baz()`, locks `this` in `class InnerClass$InnerClassA`,[Trace 2] `InnerClass$InnerClassA.(InnerClass,Object)`, locks `this` in `class InnerClass$InnerClassA`,Method call: `void InnerClass.bar()`, locks `this` in `class InnerClass`] +codetoanalyze/java/starvation/InnerClass.java, InnerClass.outerInnerBad(InnerClass$InnerClassA):void, 15, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`, locks `this` in `class InnerClass`,Method call: `void InnerClass$InnerClassA.baz()`, locks `this` in `class InnerClass$InnerClassA`,[Trace 2] `void InnerClass$InnerClassA.innerOuterBad()`, locks `this` in `class InnerClass$InnerClassA`,Method call: `void InnerClass.bar()`, locks `this` in `class InnerClass`] codetoanalyze/java/starvation/Interclass.java, Interclass.interclass1Bad(InterclassA):void, 10, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Interclass.interclass1Bad(InterclassA)`, locks `this` in `class Interclass`,Method call: `void InterclassA.interclass1Bad()`, locks `this` in `class InterclassA`,[Trace 2] `void InterclassA.interclass2Bad(Interclass)`, locks `this` in `class InterclassA`,Method call: `void Interclass.interclass2Bad()`, locks `this` in `class Interclass`] +codetoanalyze/java/starvation/Interclass.java, InterclassA.interclass2Bad(Interclass):void, 37, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InterclassA.interclass2Bad(Interclass)`, locks `this` in `class InterclassA`,Method call: `void Interclass.interclass2Bad()`, locks `this` in `class Interclass`,[Trace 2] `void Interclass.interclass1Bad(InterclassA)`, locks `this` in `class Interclass`,Method call: `void InterclassA.interclass1Bad()`, locks `this` in `class InterclassA`] codetoanalyze/java/starvation/LegacySync.java, LegacySync.onUiThreadOpBad():java.lang.Object, 25, STARVATION, no_bucket, ERROR, [[Trace 1] `Object LegacySync.onUiThreadOpBad()`, locks `this.table` in `class LegacySync`,[Trace 2] `void LegacySync.notOnUiThreadSyncedBad()`, locks `this.table` in `class LegacySync`,calls `Object Future.get()`,[Trace 1 on UI thread] `Object LegacySync.onUiThreadOpBad()`,`Object LegacySync.onUiThreadOpBad()` is annotated `UiThread`] codetoanalyze/java/starvation/LocklessTests.java, LocklessTestsA.locklessMethod():void, 23, LOCKLESS_VIOLATION, no_bucket, ERROR, [`void LocklessTestsA.locklessMethod()`, locks `this` in `class LocklessTestsA`] codetoanalyze/java/starvation/LocklessTests.java, LocklessTestsB.locklessMethod():void, 39, LOCKLESS_VIOLATION, no_bucket, ERROR, [`void LocklessTestsB.locklessMethod()`, locks `this` in `class LocklessTestsB`] @@ -35,11 +33,13 @@ codetoanalyze/java/starvation/MyActivity.java, MyActivity.onResume():void, 43, S codetoanalyze/java/starvation/MyActivity.java, MyActivity.onStart():void, 33, STARVATION, no_bucket, ERROR, [`void MyActivity.onStart()`,Method call: `void MyActivity.bad()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void MyActivity.onStart()`,`void MyActivity.onStart()` is a standard UI-thread method] codetoanalyze/java/starvation/MyActivity.java, MyActivity.onStop():void, 53, STARVATION, no_bucket, ERROR, [`void MyActivity.onStop()`,Method call: `void MyActivity.bad()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void MyActivity.onStop()`,`void MyActivity.onStop()` is a standard UI-thread method] codetoanalyze/java/starvation/NonBlk.java, NonBlk.deadlockABBad():void, 33, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void NonBlk.deadlockABBad()`, locks `this` in `class NonBlk`, locks `this.future` in `class NonBlk`,[Trace 2] `void NonBlk.deadlockBABad()`, locks `this.future` in `class NonBlk`, locks `this` in `class NonBlk`] +codetoanalyze/java/starvation/NonBlk.java, NonBlk.deadlockBABad():void, 40, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void NonBlk.deadlockBABad()`, locks `this.future` in `class NonBlk`, locks `this` in `class NonBlk`,[Trace 2] `void NonBlk.deadlockABBad()`, locks `this` in `class NonBlk`, locks `this.future` in `class NonBlk`] codetoanalyze/java/starvation/ObjWait.java, ObjWait.indirectWaitOnMainWithoutTimeoutBad():void, 46, STARVATION, no_bucket, ERROR, [[Trace 1] `void ObjWait.indirectWaitOnMainWithoutTimeoutBad()`, locks `this.lock` in `class ObjWait`,[Trace 2] `void ObjWait.lockAndWaitOnAnyWithoutTimeoutBad()`, locks `this.lock` in `class ObjWait`,calls `void Object.wait()`,[Trace 1 on UI thread] `void ObjWait.indirectWaitOnMainWithoutTimeoutBad()`,`void ObjWait.indirectWaitOnMainWithoutTimeoutBad()` is annotated `UiThread`] codetoanalyze/java/starvation/ObjWait.java, ObjWait.waitOnMainWithExcessiveTimeout1Bad():void, 31, STARVATION, no_bucket, ERROR, [`void ObjWait.waitOnMainWithExcessiveTimeout1Bad()`,calls `void Object.wait(long)`,[Trace on UI thread] `void ObjWait.waitOnMainWithExcessiveTimeout1Bad()`,`void ObjWait.waitOnMainWithExcessiveTimeout1Bad()` is annotated `UiThread`] codetoanalyze/java/starvation/ObjWait.java, ObjWait.waitOnMainWithExcessiveTimeout2Bad():void, 38, STARVATION, no_bucket, ERROR, [`void ObjWait.waitOnMainWithExcessiveTimeout2Bad()`,calls `void Object.wait(long,int)`,[Trace on UI thread] `void ObjWait.waitOnMainWithExcessiveTimeout2Bad()`,`void ObjWait.waitOnMainWithExcessiveTimeout2Bad()` is annotated `UiThread`] codetoanalyze/java/starvation/ObjWait.java, ObjWait.waitOnMainWithoutTimeoutBad():void, 24, STARVATION, no_bucket, ERROR, [`void ObjWait.waitOnMainWithoutTimeoutBad()`,calls `void Object.wait()`,[Trace on UI thread] `void ObjWait.waitOnMainWithoutTimeoutBad()`,`void ObjWait.waitOnMainWithoutTimeoutBad()` is annotated `UiThread`] codetoanalyze/java/starvation/PubPriv.java, PubPriv.alsoBad():void, 25, STARVATION, no_bucket, ERROR, [`void PubPriv.alsoBad()`,Method call: `void PubPriv.transactBad()`,Method call: `void PubPriv.doTransactOk()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void PubPriv.alsoBad()`,Method call: `void PubPriv.transactBad()`,Method call: `void PubPriv.doTransactOk()`,`void PubPriv.doTransactOk()` is annotated `UiThread`] +codetoanalyze/java/starvation/PubPriv.java, PubPriv.callAnotherWayBad():void, 53, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void PubPriv.callAnotherWayBad()`,Method call: `void PubPriv.anotherWayOk()`, locks `this.lockB` in `class PubPriv`, locks `this.lockA` in `class PubPriv`,[Trace 2] `void PubPriv.callOneWayBad()`,Method call: `void PubPriv.oneWayOk()`, locks `this.lockA` in `class PubPriv`, locks `this.lockB` in `class PubPriv`] codetoanalyze/java/starvation/PubPriv.java, PubPriv.callOneWayBad():void, 49, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void PubPriv.callOneWayBad()`,Method call: `void PubPriv.oneWayOk()`, locks `this.lockA` in `class PubPriv`, locks `this.lockB` in `class PubPriv`,[Trace 2] `void PubPriv.callAnotherWayBad()`,Method call: `void PubPriv.anotherWayOk()`, locks `this.lockB` in `class PubPriv`, locks `this.lockA` in `class PubPriv`] codetoanalyze/java/starvation/PubPriv.java, PubPriv.transactBad():void, 21, STARVATION, no_bucket, ERROR, [`void PubPriv.transactBad()`,Method call: `void PubPriv.doTransactOk()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void PubPriv.transactBad()`,Method call: `void PubPriv.doTransactOk()`,`void PubPriv.doTransactOk()` is annotated `UiThread`] codetoanalyze/java/starvation/ServiceOnUIThread.java, ServiceOnUIThread.onBind(android.content.Intent):android.os.IBinder, 19, STARVATION, no_bucket, ERROR, [`IBinder ServiceOnUIThread.onBind(Intent)`,Method call: `void ServiceOnUIThread.transactBad()`,calls `boolean IBinder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `IBinder ServiceOnUIThread.onBind(Intent)`,`IBinder ServiceOnUIThread.onBind(Intent)` is a standard UI-thread method] @@ -65,5 +65,6 @@ codetoanalyze/java/starvation/StrictModeViolation.java, StrictModeViolation.viol codetoanalyze/java/starvation/SuppLint.java, SuppLint.onUiThreadBad():void, 25, STARVATION, no_bucket, ERROR, [`void SuppLint.onUiThreadBad()`,calls `Object Future.get()`,[Trace on UI thread] `void SuppLint.onUiThreadBad()`,`void SuppLint.onUiThreadBad()` is annotated `UiThread`] codetoanalyze/java/starvation/ThreadSleep.java, ThreadSleep.indirectSleepOnUIThreadBad():void, 24, STARVATION, no_bucket, ERROR, [[Trace 1] `void ThreadSleep.indirectSleepOnUIThreadBad()`, locks `this.lock` in `class ThreadSleep`,[Trace 2] `void ThreadSleep.lockAndSleepOnNonUIThread()`, locks `this.lock` in `class ThreadSleep`,Method call: `void ThreadSleep.sleepOnAnyThreadOk()`,calls `void Thread.sleep(long)`,[Trace 1 on UI thread] `void ThreadSleep.indirectSleepOnUIThreadBad()`,`void ThreadSleep.indirectSleepOnUIThreadBad()` is annotated `UiThread`] codetoanalyze/java/starvation/ThreadSleep.java, ThreadSleep.sleepOnUIThreadBad():void, 17, STARVATION, no_bucket, ERROR, [`void ThreadSleep.sleepOnUIThreadBad()`,calls `void Thread.sleep(long)`,[Trace on UI thread] `void ThreadSleep.sleepOnUIThreadBad()`,`void ThreadSleep.sleepOnUIThreadBad()` is annotated `UiThread`] +codetoanalyze/java/starvation/UIDeadlock.java, UIDeadlock.notOnUIThreadBad():void, 34, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void UIDeadlock.notOnUIThreadBad()`, locks `this.lockB` in `class UIDeadlock`, locks `this` in `class UIDeadlock`,[Trace 2] `void UIDeadlock.onUIThreadBad()`, locks `this` in `class UIDeadlock`, locks `this.lockB` in `class UIDeadlock`] codetoanalyze/java/starvation/UIDeadlock.java, UIDeadlock.onUIThreadBad():void, 28, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void UIDeadlock.onUIThreadBad()`, locks `this` in `class UIDeadlock`, locks `this.lockB` in `class UIDeadlock`,[Trace 2] `void UIDeadlock.notOnUIThreadBad()`, locks `this.lockB` in `class UIDeadlock`, locks `this` in `class UIDeadlock`] codetoanalyze/java/starvation/Workers.java, Workers.uiThreadBad():void, 28, STARVATION, no_bucket, ERROR, [`void Workers.uiThreadBad()`,Method call: `void Workers.workerOk()`,Method call: `void Workers.doTransact()`,calls `boolean Binder.transact(int,Parcel,Parcel,int)`,[Trace on UI thread] `void Workers.uiThreadBad()`,`void Workers.uiThreadBad()` is annotated `UiThread`]