Debian Codegraph @

src/com/google/errorprone/annotations/concurrent/LockMethod.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*
2 * Copyright 2014 The Error Prone Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.errorprone.annotations.concurrent;
18
19 import static java.lang.annotation.ElementType.METHOD;
20 import static java.lang.annotation.RetentionPolicy.CLASS;
21
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.Target;
24
25 /**
26 * The method to which this annotation is applied acquires one or more locks. The caller will hold
27 * the locks when the function finishes execution.
28 *
29 * <p>This annotation does not apply to built-in (synchronization) locks, which cannot be acquired
30 * without being released in the same method.
31 *
32 * <p>The arguments determine which locks the annotated method acquires:
33 *
34 * <ul>
35 * <li><code>field-name</code>: The lock is referenced by the final instance field specified by
36 * <em>field-name</em>.
37 * <li><code>class-name.this.field-name</code>: For inner classes, it may be necessary to
38 * disambiguate 'this'; the <em>class-name.this</em> designation allows you to specify which
39 * 'this' reference is intended.
40 * <li><code>class-name.field-name</code>: The lock is referenced by the static final field
41 * specified by <em>class-name.field-name</em>.
42 * <li><code>method-name()</code>: The lock object is returned by calling the named nullary
43 * method.
44 * </ul>
45 *
46 * @deprecated the correctness of this annotation is not enforced; it will soon be removed.
47 */
48 @Target(METHOD)
49 @Retention(CLASS)
50 @Deprecated
51 public @interface LockMethod {
52 String[] value();
53 }