Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/android/findbugs_plugin/src/org/chromium/tools/findbugs/plugin/SynchronizedThisDetector.java

Issue 600983002: [Checkstyle] Fix misc style issues in Java files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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; 7 import org.apache.bcel.classfile.Code;
8 8
9 import edu.umd.cs.findbugs.BugInstance; 9 import edu.umd.cs.findbugs.BugInstance;
10 import edu.umd.cs.findbugs.BugReporter; 10 import edu.umd.cs.findbugs.BugReporter;
11 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; 11 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector;
12 12
13 /** 13 /**
14 * This class detects the synchronized(this). 14 * This class detects the synchronized(this).
15 * 15 *
16 * The pattern of byte code of synchronized(this) is 16 * The pattern of byte code of synchronized(this) is
17 * aload_0 # Load the 'this' pointer on top of stack 17 * aload_0 # Load the 'this' pointer on top of stack
18 * dup # Duplicate the 'this' pointer 18 * dup # Duplicate the 'this' pointer
19 * astore_x # Store this for late use, it might be astore. 19 * astore_x # Store this for late use, it might be astore.
20 * monitorenter 20 * monitorenter
21 */ 21 */
22 public class SynchronizedThisDetector extends OpcodeStackDetector { 22 public class SynchronizedThisDetector extends OpcodeStackDetector {
23 private final int PATTERN[] = {ALOAD_0, DUP, 0xff, 0xff, MONITORENTER}; 23 private static final int PATTERN[] = {ALOAD_0, DUP, 0xff, 0xff, MONITORENTER };
24 24
25 private int mStep = 0; 25 private int mStep = 0;
26 private BugReporter mBugReporter; 26 private BugReporter mBugReporter;
27 27
28 public SynchronizedThisDetector(BugReporter bugReporter) { 28 public SynchronizedThisDetector(BugReporter bugReporter) {
29 mBugReporter = bugReporter; 29 mBugReporter = bugReporter;
30 } 30 }
31 31
32 @Override 32 @Override
33 public void visit(Code code) { 33 public void visit(Code code) {
(...skipping 30 matching lines...) Expand all
64 break; 64 break;
65 } 65 }
66 } else if (mStep == 3) { 66 } else if (mStep == 3) {
67 // Could be any byte following the ASTORE. 67 // Could be any byte following the ASTORE.
68 mStep++; 68 mStep++;
69 } else { 69 } else {
70 mStep = 0; 70 mStep = 0;
71 } 71 }
72 } 72 }
73 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698