Extract javax.annotations from third-party/foreign-annotations
Later, JSR 305 related classes will be used to be compiled in a separate jar that will be used to compile Java, but would be absent in the Kotlin classpath in ForeignAnnotations-related tests It's necessary to have a proper test for KT-56656
This commit is contained in:
committed by
Space Team
parent
34c739789f
commit
c86c96f5e5
@@ -1,16 +0,0 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnull(when = When.MAYBE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CheckForNull {
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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;
|
||||
|
||||
@Documented
|
||||
@TypeQualifier
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Nonnull {
|
||||
When when() default When.ALWAYS;
|
||||
|
||||
static class Checker implements TypeQualifierValidator<Nonnull> {
|
||||
|
||||
public When forConstantValue(Nonnull qualifierqualifierArgument,
|
||||
Object value) {
|
||||
if (value == null)
|
||||
return When.NEVER;
|
||||
return When.ALWAYS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnull(when = When.UNKNOWN)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Nullable {
|
||||
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierDefault;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to a package, class or method to indicate that
|
||||
* the method parameters in that element are nonnull by default unless there is:
|
||||
* <ul>
|
||||
* <li>An explicit nullness annotation
|
||||
* <li>The method overrides a method in a superclass (in which case the
|
||||
* annotation of the corresponding parameter in the superclass applies)
|
||||
* <li>There is a default parameter annotation (like {@link ParametersAreNullableByDefault})
|
||||
* applied to a more tightly nested element.
|
||||
* </ul>
|
||||
*
|
||||
* @see Nonnull
|
||||
*/
|
||||
@Documented
|
||||
@Nonnull
|
||||
@TypeQualifierDefault(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ParametersAreNonnullByDefault {
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
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 {};
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* This annotation is applied to a annotation, and marks the annotation as being
|
||||
* a qualifier nickname. Applying a nickname annotation X to a element Y should
|
||||
* be interpreted as having the same meaning as applying all of annotations of X
|
||||
* (other than QualifierNickname) to Y.
|
||||
*
|
||||
* <p>
|
||||
* Thus, you might define a qualifier SocialSecurityNumber as follows:
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <code>
|
||||
@Documented
|
||||
@TypeQualifierNickname @Pattern("[0-9]{3}-[0-9]{2}-[0-9]{4}")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SocialSecurityNumber {
|
||||
}
|
||||
</code>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
public @interface TypeQualifierNickname {
|
||||
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface TypeQualifierValidator<A extends Annotation> {
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user