Reviewed By: sblackshear Differential Revision: D7427365 fbshipit-source-id: f23795fmaster
parent
b11dd03fb9
commit
462c2e2b2e
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
class StaticLock {
|
||||
static synchronized void static_synced() {}
|
||||
|
||||
void lock_same_class_one_way_ok() {
|
||||
synchronized(StaticLock.class) {
|
||||
static_synced();
|
||||
}
|
||||
}
|
||||
|
||||
static synchronized void lock_same_class_another_way_ok() {
|
||||
synchronized(StaticLock.class) {
|
||||
}
|
||||
}
|
||||
|
||||
void lock_other_class_one_way_bad() {
|
||||
synchronized(Object.class) {
|
||||
synchronized(this) {}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void lock_other_class_another_way_bad() {
|
||||
static_synced();
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
codetoanalyze/java/starvation/Interclass.java, void Interclass.interclass1_bad(InterclassA), 0, STARVATION, ERROR, [[Trace 1] Lock acquisition: locks this in class Interclass*,Method call: void InterclassA.interclass1_bad(),Lock acquisition: locks this in class InterclassA*,[Trace 2] Lock acquisition: locks this in class InterclassA*,Method call: void Interclass.interclass2_bad(),Lock acquisition: locks this in class Interclass*]
|
||||
codetoanalyze/java/starvation/Interproc.java, void Interproc.interproc1_bad(InterprocA), 0, STARVATION, ERROR, [[Trace 1] Lock acquisition: locks this in class Interproc*,Method call: void Interproc.interproc2_bad(InterprocA),Lock acquisition: locks b in class InterprocA*,[Trace 2] Lock acquisition: locks this in class InterprocA*,Method call: void InterprocA.interproc2_bad(Interproc),Lock acquisition: locks d in class Interproc*]
|
||||
codetoanalyze/java/starvation/Intraproc.java, void IntraprocA.intra_bad(Intraproc), 0, STARVATION, ERROR, [[Trace 1] Method start: void IntraprocA.intra_bad(Intraproc),Lock acquisition: locks this in class IntraprocA*,Lock acquisition: locks o in class Intraproc*,[Trace 2] Method start: void Intraproc.intra_bad(IntraprocA),Lock acquisition: locks this in class Intraproc*,Lock acquisition: locks o in class IntraprocA*]
|
||||
codetoanalyze/java/starvation/StaticLock.java, void StaticLock.lock_other_class_one_way_bad(), 0, STARVATION, ERROR, [[Trace 1] Method start: void StaticLock.lock_other_class_one_way_bad(),Lock acquisition: locks java.lang.Object$0 in class java.lang.Class*,Lock acquisition: locks this in class StaticLock*,[Trace 2] Lock acquisition: locks this in class StaticLock*,Method call: void StaticLock.static_synced(),Lock acquisition: locks StaticLock$0 in class java.lang.Class*]
|
||||
|
Loading…
Reference in new issue