OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.tools.findbugs.plugin; | 5 package org.chromium.tools.findbugs.plugin; |
6 | 6 |
| 7 import org.apache.bcel.classfile.Code; |
| 8 |
7 import edu.umd.cs.findbugs.BugInstance; | 9 import edu.umd.cs.findbugs.BugInstance; |
8 import edu.umd.cs.findbugs.BugReporter; | 10 import edu.umd.cs.findbugs.BugReporter; |
9 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; | 11 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; |
10 | 12 |
11 import org.apache.bcel.classfile.Code; | |
12 | |
13 /** | 13 /** |
14 * This class detects the synchronized method. | 14 * This class detects the synchronized method. |
15 */ | 15 */ |
16 public class SynchronizedMethodDetector extends OpcodeStackDetector { | 16 public class SynchronizedMethodDetector extends OpcodeStackDetector { |
17 | |
18 private BugReporter mBugReporter; | 17 private BugReporter mBugReporter; |
19 | 18 |
20 public SynchronizedMethodDetector(BugReporter bugReporter) { | 19 public SynchronizedMethodDetector(BugReporter bugReporter) { |
21 this.mBugReporter = bugReporter; | 20 this.mBugReporter = bugReporter; |
22 } | 21 } |
23 | 22 |
24 @Override | 23 @Override |
25 public void visit(Code code) { | 24 public void visit(Code code) { |
26 if (getMethod().isSynchronized()) { | 25 if (getMethod().isSynchronized()) { |
27 mBugReporter.reportBug(new BugInstance(this, "CHROMIUM_SYNCHRONIZED_
METHOD", | 26 mBugReporter.reportBug(new BugInstance(this, "CHROMIUM_SYNCHRONIZED_
METHOD", |
28 NORMAL_PRIORITY) | 27 NORMAL_PRIORITY) |
29 .addClassAndMethod(this) | 28 .addClassAndMethod(this) |
30 .addSourceLine(this)); | 29 .addSourceLine(this)); |
31 } | 30 } |
32 super.visit(code); | 31 super.visit(code); |
33 } | 32 } |
34 | 33 |
35 @Override | 34 @Override |
36 public void sawOpcode(int arg0) { | 35 public void sawOpcode(int arg0) { |
37 } | 36 } |
38 } | 37 } |
OLD | NEW |