Index: tools/android/findbugs_plugin/src/org/chromium/tools/findbugs/plugin/SynchronizedMethodDetector.java |
diff --git a/tools/android/findbugs_plugin/src/org/chromium/tools/findbugs/plugin/SynchronizedMethodDetector.java b/tools/android/findbugs_plugin/src/org/chromium/tools/findbugs/plugin/SynchronizedMethodDetector.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d1d7614a1e116140f816ea9e698e7ca9f840227c |
--- /dev/null |
+++ b/tools/android/findbugs_plugin/src/org/chromium/tools/findbugs/plugin/SynchronizedMethodDetector.java |
@@ -0,0 +1,37 @@ |
+// Copyright 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.tools.findbugs.plugin; |
+ |
+import org.apache.bcel.classfile.Code; |
+ |
+import edu.umd.cs.findbugs.BugInstance; |
+import edu.umd.cs.findbugs.BugReporter; |
+import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; |
+ |
+/** |
+ * This class detects the synchronized method. |
+ */ |
+public class SynchronizedMethodDetector extends OpcodeStackDetector { |
+ private BugReporter mBugReporter; |
+ |
+ public SynchronizedMethodDetector(BugReporter bugReporter) { |
+ this.mBugReporter = bugReporter; |
+ } |
+ |
+ @Override |
+ public void visit(Code code) { |
+ if (getMethod().isSynchronized()) { |
+ mBugReporter.reportBug(new BugInstance(this, "CHROMIUM_SYNCHRONIZED_METHOD", |
+ NORMAL_PRIORITY) |
+ .addClassAndMethod(this) |
+ .addSourceLine(this)); |
+ } |
+ super.visit(code); |
+ } |
+ |
+ @Override |
+ public void sawOpcode(int arg0) { |
+ } |
+} |