All Downloads are FREE. Search and download functionalities are using the official Maven repository.

checker.src.org.checkerframework.checker.lock.qual.GuardedBy Maven / Gradle / Ivy

Go to download

The Checker Framework enhances Java’s type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.42.0
Show newest version
/*
 * Copyright (c) 2005 Brian Goetz and Tim Peierls
 * Released under the Creative Commons Attribution License
 *   (http://creativecommons.org/licenses/by/2.5)
 * Official home: http://www.jcip.net
 *
 * Any republication or derived work distributed in source code form
 * must include this copyright and license notice.
 */
/*
 * Modified for use with the Checker Framework Lock Checker
 */

package org.checkerframework.checker.lock.qual;

import java.lang.annotation.*;
import javax.lang.model.type.TypeKind;

import org.checkerframework.framework.qual.DefaultFor;
import org.checkerframework.framework.qual.DefaultInUncheckedCodeFor;
import org.checkerframework.framework.qual.DefaultQualifierInHierarchy;
import org.checkerframework.framework.qual.ImplicitFor;
import org.checkerframework.framework.qual.SubtypeOf;
import org.checkerframework.framework.qual.TypeUseLocation;

/**
 * Indicates that a thread may dereference the value referred to by the
 * annotated variable only if the thread holds all the given lock expressions.
 * 

* * @GuardedBy({}) is the default type qualifier. *

* * The argument is a string or set of strings that indicates the * expression(s) that must be held, using the syntax * of Java expressions described in the manual. * The expressions evaluate to an intrinsic (built-in, synchronization) * monitor or an explicit {@link java.util.concurrent.locks.Lock}. The * expression {@code "itself"} is also permitted; the type * {@code @GuardedBy("itself") Object o} indicates that the value * referenced by {@code o} is guarded by the intrinsic (monitor) lock of * the value referenced by {@code o}. *

* * Two @GuardedBy annotations with different argument expressions * are unrelated by subtyping. *

* * @see Holding * @checker_framework.manual #lock-checker Lock Checker * @checker_framework.manual #lock-examples-guardedby Example use of @GuardedBy */ @SubtypeOf(GuardedByUnknown.class) @Documented @DefaultQualifierInHierarchy @DefaultFor({TypeUseLocation.EXCEPTION_PARAMETER, TypeUseLocation.UPPER_BOUND}) @DefaultInUncheckedCodeFor({TypeUseLocation.PARAMETER}) @ImplicitFor(types = { TypeKind.BOOLEAN, TypeKind.BYTE, TypeKind.CHAR, TypeKind.DOUBLE, TypeKind.FLOAT, TypeKind.INT, TypeKind.LONG, TypeKind.SHORT }, typeNames = { java.lang.String.class }) @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) public @interface GuardedBy { /** * The Java value expressions that need to be held. * * @see Syntax * of Java expressions */ String[] value() default {}; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy