* Thus, you might define a qualifier SocialSecurityNumber as follows: *
* * *
@Documented
@TypeQualifierNickname @Pattern("[0-9]{3}-[0-9]{2}-[0-9]{4}")
@Retention(RetentionPolicy.RUNTIME)
public @interface SocialSecurityNumber {
}
*
*
*/
@Documented
@Target(ElementType.ANNOTATION_TYPE)
public @interface TypeQualifierNickname {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/TypeQualifier.java 0000600 0000000 0000000 00000001434 11054435071 025707 0 ustar package javax.annotation.meta;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This qualifier is applied to an annotation to denote that the annotation
* should be treated as a type qualifier.
*/
@Documented
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TypeQualifier {
/**
* Describes the kinds of values the qualifier can be applied to. If a
* numeric class is provided (e.g., Number.class or Integer.class) then the
* annotation can also be applied to the corresponding primitive numeric
* types.
*/
Class> applicableTo() default Object.class;
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/TypeQualifierValidator.java 0000600 0000000 0000000 00000001257 11054435071 027560 0 ustar package javax.annotation.meta;
import java.lang.annotation.Annotation;
import javax.annotation.Nonnull;
public interface TypeQualifierValidator {
/**
* Given a type qualifier, check to see if a known specific constant value
* is an instance of the set of values denoted by the qualifier.
*
* @param annotation
* the type qualifier
* @param value
* the value to check
* @return a value indicating whether or not the value is an member of the
* values denoted by the type qualifier
*/
public @Nonnull
When forConstantValue(@Nonnull A annotation, Object value);
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/TypeQualifierDefault.java 0000600 0000000 0000000 00000001116 11054435071 027211 0 ustar package javax.annotation.meta;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This qualifier is applied to an annotation to denote that the annotation
* defines a default type qualifier that is visible within the scope of the
* element it is applied to.
*/
@Documented
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TypeQualifierDefault {
ElementType[] value() default {};
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/Exhaustive.java 0000600 0000000 0000000 00000002111 11054435071 025242 0 ustar package javax.annotation.meta;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* This annotation can be applied to the value() element of an annotation that
* is annotated as a TypeQualifier. This is only appropriate if the value field
* returns a value that is an Enumeration.
*
* Applications of the type qualifier with different values are exclusive, and
* the enumeration is an exhaustive list of the possible values.
*
* For example, the following defines a type qualifier such that if you know a
* value is neither {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)},
* then the value must be {@literal @Foo(Color.Green)}. And if you know it is
* {@literal @Foo(Color.Green)}, you know it cannot be
* {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)}
*
*
* @TypeQualifier @interface Foo {
* enum Color {RED, BLUE, GREEN};
* @Exhaustive Color value();
* }
*
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Exhaustive {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/Exclusive.java 0000600 0000000 0000000 00000001212 11054435071 025065 0 ustar package javax.annotation.meta;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* This annotation can be applied to the value() element of an annotation that
* is annotated as a TypeQualifier.
*
* For example, the following defines a type qualifier such that if you know a
* value is {@literal @Foo(1)}, then the value cannot be {@literal @Foo(2)} or {{@literal @Foo(3)}.
*
*
* @TypeQualifier @interface Foo {
* @Exclusive int value();
* }
*
*
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Exclusive {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/meta/When.java 0000600 0000000 0000000 00000001177 11054435071 024031 0 ustar package javax.annotation.meta;
/**
* Used to describe the relationship between a qualifier T and the set of values
* S possible on an annotated element.
*
* In particular, an issues should be reported if an ALWAYS or MAYBE value is
* used where a NEVER value is required, or if a NEVER or MAYBE value is used
* where an ALWAYS value is required.
*
*
*/
public enum When {
/** S is a subset of T */
ALWAYS,
/** nothing definitive is known about the relation between S and T */
UNKNOWN,
/** S intersection T is non empty and S - T is nonempty */
MAYBE,
/** S intersection T is empty */
NEVER;
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/concurrent/ 0000700 0000000 0000000 00000000000 11433313255 023511 5 ustar libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/concurrent/NotThreadSafe.java 0000600 0000000 0000000 00000001574 11054435071 027054 0 ustar package javax.annotation.concurrent;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
* Copyright (c) 2005 Brian Goetz
* Released under the Creative Commons Attribution License
* (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*/
/**
* NotThreadSafe
*
* The class to which this annotation is applied is not thread-safe. This
* annotation primarily exists for clarifying the non-thread-safety of a class
* that might otherwise be assumed to be thread-safe, despite the fact that it
* is a bad idea to assume a class is thread-safe without good reason.
*
* @see ThreadSafe
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface NotThreadSafe {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/concurrent/Immutable.java 0000600 0000000 0000000 00000002465 11054435071 026304 0 ustar package javax.annotation.concurrent;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
* Copyright (c) 2005 Brian Goetz
* Released under the Creative Commons Attribution License
* (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*/
/**
* Immutable
*
* The class to which this annotation is applied is immutable. This means that
* its state cannot be seen to change by callers. Of necessity this means that
* all public fields are final, and that all public final reference fields refer
* to other immutable objects, and that methods do not publish references to any
* internal state which is mutable by implementation even if not by design.
* Immutable objects may still have internal mutable state for purposes of
* performance optimization; some state variables may be lazily computed, so
* long as they are computed from immutable state and that callers cannot tell
* the difference.
*
* Immutable objects are inherently thread-safe; they may be passed between
* threads or published without synchronization.
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface Immutable {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/concurrent/ThreadSafe.java 0000600 0000000 0000000 00000001360 11054435071 026364 0 ustar package javax.annotation.concurrent;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* ThreadSafe
*
* The class to which this annotation is applied is thread-safe. This means that
* no sequences of accesses (reads and writes to public fields, calls to public
* methods) may put the object into an invalid state, regardless of the
* interleaving of those actions by the runtime, and without requiring any
* additional synchronization or coordination on the part of the caller.
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface ThreadSafe {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/concurrent/GuardedBy.java 0000600 0000000 0000000 00000003113 11054435071 026222 0 ustar package javax.annotation.concurrent;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
* Copyright (c) 2005 Brian Goetz
* Released under the Creative Commons Attribution License
* (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*/
/**
* GuardedBy
*
* The field or method to which this annotation is applied can only be accessed
* when holding a particular lock, which may be a built-in (synchronization)
* lock, or may be an explicit java.util.concurrent.Lock.
*
* The argument determines which lock guards the annotated field or method: this :
* The string literal "this" means that this field is guarded by the class in
* which it is defined. class-name.this : For inner classes, it may be necessary
* to disambiguate 'this'; the class-name.this designation allows you to specify
* which 'this' reference is intended itself : For reference fields only; the
* object to which the field refers. field-name : The lock object is referenced
* by the (instance or static) field specified by field-name.
* class-name.field-name : The lock object is reference by the static field
* specified by class-name.field-name. method-name() : The lock object is
* returned by calling the named nil-ary method. class-name.class : The Class
* object for the specified class should be used as the lock object.
*/
@Target( { ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.CLASS)
public @interface GuardedBy {
String value();
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/MatchesPattern.java 0000600 0000000 0000000 00000001563 11054435071 025123 0 ustar package javax.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.regex.Pattern;
import javax.annotation.meta.TypeQualifier;
import javax.annotation.meta.TypeQualifierValidator;
import javax.annotation.meta.When;
@Documented
@TypeQualifier(applicableTo = String.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface MatchesPattern {
@RegEx
String value();
int flags() default 0;
static class Checker implements TypeQualifierValidatorThis annotation implies the same "nullness" as no annotation. However, it is different
* than having no annotation, as it is inherited and it can override a ParametersAreNonnullByDefault
* annotation at an outer scope.
*
*/
@Documented
@Nullable
@TypeQualifierDefault(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface ParametersAreNullableByDefault {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/WillClose.java 0000600 0000000 0000000 00000000521 11054442005 024062 0 ustar package javax.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Documented
@Retention(RetentionPolicy.RUNTIME)
/**
* Used to annotate a method parameter to indicate that this method will close
* the resource.
*/
public @interface WillClose {
}
libjsr305-java-0.1~+svn49.orig/ri/src/main/java/javax/annotation/Nonnegative.java 0000600 0000000 0000000 00000002427 11054435071 024456 0 ustar package javax.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.annotation.meta.TypeQualifier;
import javax.annotation.meta.TypeQualifierValidator;
import javax.annotation.meta.When;
/** Used to annotate a value that should only contain nonnegative values */
@Documented
@TypeQualifier(applicableTo = Number.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface Nonnegative {
When when() default When.ALWAYS;
class Checker implements TypeQualifierValidator