/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.support.annotation;

import java.lang.annotation.Retention;

import static java.lang.annotation.RetentionPolicy.CLASS;

/**
 * Denotes that the class, method or field has its visibility relaxed, so that it is more widely
 * visible than otherwise necessary to make code testable.
 */
@Retention(CLASS)
public @interface VisibleForTesting {
}

@@ -747,16 +747,75 @@
 y.CLASS;
+%0Aimport static java.lang.annotation.RetentionPolicy.SOURCE;
 %0A%0A/**%0A *
@@ -974,64 +974,1410 @@
 .%0A *
-/%0A@Retention(CLASS)%0Apublic @interface VisibleForTesting %7B
+ %3Cp%3E%0A * You can optionally specify what the visibility %3Cb%3Eshould%3C/b%3E have been if not for%0A * testing; this allows tools to catch unintended access from within production%0A * code.%0A * %3Cp%3E%0A * Example:%0A * %3Cpre%3E%3Ccode%3E%0A *  &#64;VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)%0A *  public String printDiagnostics() %7B ... %7D%0A * %3C/code%3E%3C/pre%3E%0A *%0A * If not specified, the intended visibility is assumed to be private.%0A */%0A@Retention(CLASS)%0Apublic @interface VisibleForTesting %7B%0A    /**%0A     * The visibility the annotated element would have if it did not need to be made visible for%0A     * testing.%0A     */%0A    @ProductionVisibility%0A    int otherwise() default PRIVATE;%0A%0A    /**%0A     * The annotated element would have %22private%22 visibility%0A     */%0A    int PRIVATE = 2; // Happens to be the same as Modifier.PRIVATE%0A%0A    /**%0A     * The annotated element would have %22package private%22 visibility%0A     */%0A    int PACKAGE_PRIVATE = 3;%0A%0A    /**%0A     * The annotated element would have %22protected%22 visibility%0A     */%0A    int PROTECTED = 4; // Happens to be the same as Modifier.PROTECTED%0A%0A    /**%0A     * The annotated element should never be called from production code, only from tests.%0A     * %3Cp%3E%0A     * This is equivalent to %7B@code @RestrictTo.Scope.TESTS%7D.%0A     */%0A    int NONE = 5;%0A%0A    @IntDef(%7BPRIVATE, PACKAGE_PRIVATE, PROTECTED, NONE%7D)%0A    @Retention(SOURCE)%0A    @interface ProductionVisibility %7B%0A    %7D
 %0A%7D%0A

Add production visibility to @VisibleForTesting am: 6b55d5559e am: fcfab141cf