[SPARK-26055][CORE] InterfaceStability annotations should be retained at runtime

## What changes were proposed in this pull request?

It's good to have annotations available at runtime, so that tools like MiMa can detect them and deal with then specially. e.g. we don't want to track compatibility for unstable classes.

This PR makes `InterfaceStability` annotations to be retained at runtime, to be consistent with `Experimental` and `DeveloperApi`

## How was this patch tested?
N/A

Closes #23029 from cloud-fan/annotation.

Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This commit is contained in:
Wenchen Fan 2018-11-15 20:25:27 +08:00
parent b46f75a5af
commit 9610efc252
4 changed files with 14 additions and 5 deletions

View file

@ -29,6 +29,7 @@ import java.lang.annotation.*;
* of the known issue that Scaladoc displays only either the annotation or the comment, whichever
* comes first.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})

View file

@ -30,6 +30,7 @@ import java.lang.annotation.*;
* of the known issue that Scaladoc displays only either the annotation or the comment, whichever
* comes first.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})

View file

@ -17,7 +17,7 @@
package org.apache.spark.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.*;
/**
* Annotation to inform users of how much to rely on a particular package,
@ -31,6 +31,9 @@ public class InterfaceStability {
* (e.g. from 1.0 to 2.0).
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Stable {};
/**
@ -38,6 +41,9 @@ public class InterfaceStability {
* Evolving interfaces can change from one feature release to another release (i.e. 2.1 to 2.2).
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Evolving {};
/**
@ -45,5 +51,8 @@ public class InterfaceStability {
* Classes that are unannotated are considered Unstable.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
public @interface Unstable {};
}

View file

@ -17,10 +17,7 @@
package org.apache.spark.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;
/**
* A class that is considered private to the internals of Spark -- there is a high-likelihood
@ -35,6 +32,7 @@ import java.lang.annotation.Target;
* of the known issue that Scaladoc displays only either the annotation or the comment, whichever
* comes first.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})