• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.aconfig.annotations;
18 
19 import static java.lang.annotation.ElementType.METHOD;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.lang.annotation.Target;
24 
25 /**
26  * Denotes that the method has its visibility relaxed so
27  * that unit tests can access it.
28  * <p/>
29  * The <code>visibility</code> argument can be used to specific what the original
30  * visibility should have been if it had not been made public or package-private for testing.
31  * The default is to consider the element private.
32  */
33 @Retention(RetentionPolicy.CLASS)
34 @Target({METHOD})
35 public @interface VisibleForTesting {
36     /**
37      * Intended visibility if the element had not been made public or package-private for
38      * testing.
39      */
40     enum Visibility {
41         /** The element should be considered protected. */
42         PROTECTED,
43         /** The element should be considered package-private. */
44         PACKAGE,
45         /** The element should be considered private. */
46         PRIVATE
47     }
48 
49     /**
50      * Intended visibility if the element had not been made public or package-private for testing.
51      * If not specified, one should assume the element originally intended to be private.
52      */
visibility()53     Visibility visibility() default Visibility.PRIVATE;
54 }
55