blob: e149232708595bfb32aaed836cd9fefdf7d22a85 [file] [log] [blame]
Søren Gjesse43a16782025-02-24 09:19:24 +01001/*
2 * Copyright 2025 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// ***********************************************************************************
18// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
19// ***********************************************************************************
20
21// ***********************************************************************************
22// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
23// ***********************************************************************************
24
25package androidx.annotation.keep
26
27import kotlin.annotation.Retention
28import kotlin.annotation.Target
29import kotlin.reflect.KClass
30
31/**
32 * A condition for a keep edge.
33 *
34 * <p>
35 * The condition denotes an item used as a precondition of a rule. An item can be:
36 * <ul>
37 * <li>a pattern on classes;
38 * <li>a pattern on methods; or
39 * <li>a pattern on fields.
40 * </ul>
41 */
42@Retention(AnnotationRetention.BINARY)
43@Target(AnnotationTarget.ANNOTATION_CLASS)
Søren Gjessef1d79d52025-02-24 12:17:45 +010044public annotation class KeepCondition(
Søren Gjesse43a16782025-02-24 09:19:24 +010045
46 /**
47 * Define the class pattern by reference to a binding.
48 *
49 * <p>
50 * Mutually exclusive with the following other properties defining class:
51 * <ul>
52 * <li>className
53 * <li>classConstant
54 * <li>classNamePattern
55 * <li>instanceOfClassName
56 * <li>instanceOfClassNameExclusive
57 * <li>instanceOfClassConstant
58 * <li>instanceOfClassConstantExclusive
59 * <li>instanceOfPattern
60 * <li>classAnnotatedByClassName
61 * <li>classAnnotatedByClassConstant
62 * <li>classAnnotatedByClassNamePattern
63 * </ul>
64 *
65 * <p>
66 * If none are specified the default is to match any class.
67 *
68 * @return The name of the binding that defines the class.
69 */
70 val classFromBinding: String = "",
71
72 /**
73 * Define the class-name pattern by fully qualified class name.
74 *
75 * <p>
76 * Mutually exclusive with the following other properties defining class-name:
77 * <ul>
78 * <li>classConstant
79 * <li>classNamePattern
80 * <li>classFromBinding
81 * </ul>
82 *
83 * <p>
84 * If none are specified the default is to match any class name.
85 *
86 * @return The qualified class name that defines the class.
87 */
88 val className: String = "",
89
90 /**
91 * Define the class-name pattern by reference to a Class constant.
92 *
93 * <p>
94 * Mutually exclusive with the following other properties defining class-name:
95 * <ul>
96 * <li>className
97 * <li>classNamePattern
98 * <li>classFromBinding
99 * </ul>
100 *
101 * <p>
102 * If none are specified the default is to match any class name.
103 *
104 * @return The class-constant that defines the class.
105 */
106 val classConstant: KClass<*> = Object::class,
107
108 /**
109 * Define the class-name pattern by reference to a class-name pattern.
110 *
111 * <p>
112 * Mutually exclusive with the following other properties defining class-name:
113 * <ul>
114 * <li>className
115 * <li>classConstant
116 * <li>classFromBinding
117 * </ul>
118 *
119 * <p>
120 * If none are specified the default is to match any class name.
121 *
122 * @return The class-name pattern that defines the class.
123 */
124 val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
125
126 /**
127 * Define the instance-of pattern as classes that are instances of the fully qualified class name.
128 *
129 * <p>
130 * Mutually exclusive with the following other properties defining instance-of:
131 * <ul>
132 * <li>instanceOfClassNameExclusive
133 * <li>instanceOfClassConstant
134 * <li>instanceOfClassConstantExclusive
135 * <li>instanceOfPattern
136 * <li>classFromBinding
137 * </ul>
138 *
139 * <p>
140 * If none are specified the default is to match any class instance.
141 *
142 * @return The qualified class name that defines what instance-of the class must be.
143 */
144 val instanceOfClassName: String = "",
145
146 /**
147 * Define the instance-of pattern as classes that are instances of the fully qualified class name.
148 *
149 * <p>
150 * The pattern is exclusive in that it does not match classes that are instances of the pattern,
151 * but only those that are instances of classes that are subclasses of the pattern.
152 *
153 * <p>
154 * Mutually exclusive with the following other properties defining instance-of:
155 * <ul>
156 * <li>instanceOfClassName
157 * <li>instanceOfClassConstant
158 * <li>instanceOfClassConstantExclusive
159 * <li>instanceOfPattern
160 * <li>classFromBinding
161 * </ul>
162 *
163 * <p>
164 * If none are specified the default is to match any class instance.
165 *
166 * @return The qualified class name that defines what instance-of the class must be.
167 */
168 val instanceOfClassNameExclusive: String = "",
169
170 /**
171 * Define the instance-of pattern as classes that are instances the referenced Class constant.
172 *
173 * <p>
174 * Mutually exclusive with the following other properties defining instance-of:
175 * <ul>
176 * <li>instanceOfClassName
177 * <li>instanceOfClassNameExclusive
178 * <li>instanceOfClassConstantExclusive
179 * <li>instanceOfPattern
180 * <li>classFromBinding
181 * </ul>
182 *
183 * <p>
184 * If none are specified the default is to match any class instance.
185 *
186 * @return The class constant that defines what instance-of the class must be.
187 */
188 val instanceOfClassConstant: KClass<*> = Object::class,
189
190 /**
191 * Define the instance-of pattern as classes that are instances the referenced Class constant.
192 *
193 * <p>
194 * The pattern is exclusive in that it does not match classes that are instances of the pattern,
195 * but only those that are instances of classes that are subclasses of the pattern.
196 *
197 * <p>
198 * Mutually exclusive with the following other properties defining instance-of:
199 * <ul>
200 * <li>instanceOfClassName
201 * <li>instanceOfClassNameExclusive
202 * <li>instanceOfClassConstant
203 * <li>instanceOfPattern
204 * <li>classFromBinding
205 * </ul>
206 *
207 * <p>
208 * If none are specified the default is to match any class instance.
209 *
210 * @return The class constant that defines what instance-of the class must be.
211 */
212 val instanceOfClassConstantExclusive: KClass<*> = Object::class,
213
214 /**
215 * Define the instance-of with a pattern.
216 *
217 * <p>
218 * Mutually exclusive with the following other properties defining instance-of:
219 * <ul>
220 * <li>instanceOfClassName
221 * <li>instanceOfClassNameExclusive
222 * <li>instanceOfClassConstant
223 * <li>instanceOfClassConstantExclusive
224 * <li>classFromBinding
225 * </ul>
226 *
227 * <p>
228 * If none are specified the default is to match any class instance.
229 *
230 * @return The pattern that defines what instance-of the class must be.
231 */
232 val instanceOfPattern: InstanceOfPattern = InstanceOfPattern(),
233
234 /**
235 * Define the class-annotated-by pattern by fully qualified class name.
236 *
237 * <p>
238 * Mutually exclusive with the following other properties defining class-annotated-by:
239 * <ul>
240 * <li>classAnnotatedByClassConstant
241 * <li>classAnnotatedByClassNamePattern
242 * <li>classFromBinding
243 * </ul>
244 *
245 * <p>
246 * If none are specified the default is to match any class regardless of what the class is
247 * annotated by.
248 *
249 * @return The qualified class name that defines the annotation.
250 */
251 val classAnnotatedByClassName: String = "",
252
253 /**
254 * Define the class-annotated-by pattern by reference to a Class constant.
255 *
256 * <p>
257 * Mutually exclusive with the following other properties defining class-annotated-by:
258 * <ul>
259 * <li>classAnnotatedByClassName
260 * <li>classAnnotatedByClassNamePattern
261 * <li>classFromBinding
262 * </ul>
263 *
264 * <p>
265 * If none are specified the default is to match any class regardless of what the class is
266 * annotated by.
267 *
268 * @return The class-constant that defines the annotation.
269 */
270 val classAnnotatedByClassConstant: KClass<*> = Object::class,
271
272 /**
273 * Define the class-annotated-by pattern by reference to a class-name pattern.
274 *
275 * <p>
276 * Mutually exclusive with the following other properties defining class-annotated-by:
277 * <ul>
278 * <li>classAnnotatedByClassName
279 * <li>classAnnotatedByClassConstant
280 * <li>classFromBinding
281 * </ul>
282 *
283 * <p>
284 * If none are specified the default is to match any class regardless of what the class is
285 * annotated by.
286 *
287 * @return The class-name pattern that defines the annotation.
288 */
289 val classAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
290
291 /**
292 * Define the member pattern in full by a reference to a binding.
293 *
294 * <p>
295 * Mutually exclusive with all other class and member pattern properties. When a member binding is
296 * referenced this item is defined to be that item, including its class and member patterns.
297 *
298 * @return The binding name that defines the member.
299 */
300 val memberFromBinding: String = "",
301
302 /**
303 * Define the member-annotated-by pattern by fully qualified class name.
304 *
305 * <p>
306 * Mutually exclusive with the following other properties defining member-annotated-by:
307 * <ul>
308 * <li>memberAnnotatedByClassConstant
309 * <li>memberAnnotatedByClassNamePattern
310 * <li>memberFromBinding
311 * </ul>
312 *
313 * <p>
314 * Mutually exclusive with all field and method properties as use restricts the match to both
315 * types of members.
316 *
317 * <p>
318 * If none are specified the default is to match any member regardless of what the member is
319 * annotated by.
320 *
321 * @return The qualified class name that defines the annotation.
322 */
323 val memberAnnotatedByClassName: String = "",
324
325 /**
326 * Define the member-annotated-by pattern by reference to a Class constant.
327 *
328 * <p>
329 * Mutually exclusive with the following other properties defining member-annotated-by:
330 * <ul>
331 * <li>memberAnnotatedByClassName
332 * <li>memberAnnotatedByClassNamePattern
333 * <li>memberFromBinding
334 * </ul>
335 *
336 * <p>
337 * Mutually exclusive with all field and method properties as use restricts the match to both
338 * types of members.
339 *
340 * <p>
341 * If none are specified the default is to match any member regardless of what the member is
342 * annotated by.
343 *
344 * @return The class-constant that defines the annotation.
345 */
346 val memberAnnotatedByClassConstant: KClass<*> = Object::class,
347
348 /**
349 * Define the member-annotated-by pattern by reference to a class-name pattern.
350 *
351 * <p>
352 * Mutually exclusive with the following other properties defining member-annotated-by:
353 * <ul>
354 * <li>memberAnnotatedByClassName
355 * <li>memberAnnotatedByClassConstant
356 * <li>memberFromBinding
357 * </ul>
358 *
359 * <p>
360 * Mutually exclusive with all field and method properties as use restricts the match to both
361 * types of members.
362 *
363 * <p>
364 * If none are specified the default is to match any member regardless of what the member is
365 * annotated by.
366 *
367 * @return The class-name pattern that defines the annotation.
368 */
369 val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
370
371 /**
372 * Define the member-access pattern by matching on access flags.
373 *
374 * <p>
375 * Mutually exclusive with all field and method properties as use restricts the match to both
376 * types of members.
377 *
378 * <p>
379 * Mutually exclusive with the property `memberFromBinding` also defining member-access.
380 *
381 * @return The member access-flag constraints that must be met.
382 */
383 val memberAccess: Array<MemberAccessFlags> = [],
384
385 /**
386 * Define the method-annotated-by pattern by fully qualified class name.
387 *
388 * <p>
389 * Mutually exclusive with the following other properties defining method-annotated-by:
390 * <ul>
391 * <li>methodAnnotatedByClassConstant
392 * <li>methodAnnotatedByClassNamePattern
393 * <li>memberFromBinding
394 * </ul>
395 *
396 * <p>
397 * Mutually exclusive with all field properties.
398 *
399 * <p>
400 * If none are specified the default is to match any method regardless of what the method is
401 * annotated by.
402 *
403 * @return The qualified class name that defines the annotation.
404 */
405 val methodAnnotatedByClassName: String = "",
406
407 /**
408 * Define the method-annotated-by pattern by reference to a Class constant.
409 *
410 * <p>
411 * Mutually exclusive with the following other properties defining method-annotated-by:
412 * <ul>
413 * <li>methodAnnotatedByClassName
414 * <li>methodAnnotatedByClassNamePattern
415 * <li>memberFromBinding
416 * </ul>
417 *
418 * <p>
419 * Mutually exclusive with all field properties.
420 *
421 * <p>
422 * If none are specified the default is to match any method regardless of what the method is
423 * annotated by.
424 *
425 * @return The class-constant that defines the annotation.
426 */
427 val methodAnnotatedByClassConstant: KClass<*> = Object::class,
428
429 /**
430 * Define the method-annotated-by pattern by reference to a class-name pattern.
431 *
432 * <p>
433 * Mutually exclusive with the following other properties defining method-annotated-by:
434 * <ul>
435 * <li>methodAnnotatedByClassName
436 * <li>methodAnnotatedByClassConstant
437 * <li>memberFromBinding
438 * </ul>
439 *
440 * <p>
441 * Mutually exclusive with all field properties.
442 *
443 * <p>
444 * If none are specified the default is to match any method regardless of what the method is
445 * annotated by.
446 *
447 * @return The class-name pattern that defines the annotation.
448 */
449 val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
450
451 /**
452 * Define the method-access pattern by matching on access flags.
453 *
454 * <p>
455 * Mutually exclusive with all field properties.
456 *
457 * <p>
458 * If none, and other properties define this item as a method, the default matches any
459 * method-access flags.
460 *
461 * <p>
462 * Mutually exclusive with the property `memberFromBinding` also defining method-access.
463 *
464 * @return The method access-flag constraints that must be met.
465 */
466 val methodAccess: Array<MethodAccessFlags> = [],
467
468 /**
469 * Define the method-name pattern by an exact method name.
470 *
471 * <p>
472 * Mutually exclusive with all field properties.
473 *
474 * <p>
475 * If none, and other properties define this item as a method, the default matches any method
476 * name.
477 *
478 * <p>
479 * Mutually exclusive with the following other properties defining method-name:
480 * <ul>
481 * <li>methodNamePattern
482 * <li>memberFromBinding
483 * </ul>
484 *
485 * @return The exact method name of the method.
486 */
487 val methodName: String = "",
488
489 /**
490 * Define the method-name pattern by a string pattern.
491 *
492 * <p>
493 * Mutually exclusive with all field properties.
494 *
495 * <p>
496 * If none, and other properties define this item as a method, the default matches any method
497 * name.
498 *
499 * <p>
500 * Mutually exclusive with the following other properties defining method-name:
501 * <ul>
502 * <li>methodName
503 * <li>memberFromBinding
504 * </ul>
505 *
506 * @return The string pattern of the method name.
507 */
508 val methodNamePattern: StringPattern = StringPattern(exact = ""),
509
510 /**
511 * Define the method return-type pattern by a fully qualified type or 'void'.
512 *
513 * <p>
514 * Mutually exclusive with all field properties.
515 *
516 * <p>
517 * If none, and other properties define this item as a method, the default matches any return
518 * type.
519 *
520 * <p>
521 * Mutually exclusive with the following other properties defining return-type:
522 * <ul>
523 * <li>methodReturnTypeConstant
524 * <li>methodReturnTypePattern
525 * <li>memberFromBinding
526 * </ul>
527 *
528 * @return The qualified type name of the method return type.
529 */
530 val methodReturnType: String = "",
531
532 /**
533 * Define the method return-type pattern by a class constant.
534 *
535 * <p>
536 * Mutually exclusive with all field properties.
537 *
538 * <p>
539 * If none, and other properties define this item as a method, the default matches any return
540 * type.
541 *
542 * <p>
543 * Mutually exclusive with the following other properties defining return-type:
544 * <ul>
545 * <li>methodReturnType
546 * <li>methodReturnTypePattern
547 * <li>memberFromBinding
548 * </ul>
549 *
550 * @return A class constant denoting the type of the method return type.
551 */
552 val methodReturnTypeConstant: KClass<*> = Object::class,
553
554 /**
555 * Define the method return-type pattern by a type pattern.
556 *
557 * <p>
558 * Mutually exclusive with all field properties.
559 *
560 * <p>
561 * If none, and other properties define this item as a method, the default matches any return
562 * type.
563 *
564 * <p>
565 * Mutually exclusive with the following other properties defining return-type:
566 * <ul>
567 * <li>methodReturnType
568 * <li>methodReturnTypeConstant
569 * <li>memberFromBinding
570 * </ul>
571 *
572 * @return The pattern of the method return type.
573 */
574 val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
575
576 /**
577 * Define the method parameters pattern by a list of fully qualified types.
578 *
579 * <p>
580 * Mutually exclusive with all field properties.
581 *
582 * <p>
583 * If none, and other properties define this item as a method, the default matches any parameters.
584 *
585 * <p>
586 * Mutually exclusive with the following other properties defining parameters:
587 * <ul>
588 * <li>methodParameterTypePatterns
589 * <li>memberFromBinding
590 * </ul>
591 *
592 * @return The list of qualified type names of the method parameters.
593 */
594 val methodParameters: Array<String> = [""],
595
596 /**
597 * Define the method parameters pattern by a list of patterns on types.
598 *
599 * <p>
600 * Mutually exclusive with all field properties.
601 *
602 * <p>
603 * If none, and other properties define this item as a method, the default matches any parameters.
604 *
605 * <p>
606 * Mutually exclusive with the following other properties defining parameters:
607 * <ul>
608 * <li>methodParameters
609 * <li>memberFromBinding
610 * </ul>
611 *
612 * @return The list of type patterns for the method parameters.
613 */
614 val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
615
616 /**
617 * Define the field-annotated-by pattern by fully qualified class name.
618 *
619 * <p>
620 * Mutually exclusive with the following other properties defining field-annotated-by:
621 * <ul>
622 * <li>fieldAnnotatedByClassConstant
623 * <li>fieldAnnotatedByClassNamePattern
624 * <li>memberFromBinding
625 * </ul>
626 *
627 * <p>
628 * Mutually exclusive with all method properties.
629 *
630 * <p>
631 * If none are specified the default is to match any field regardless of what the field is
632 * annotated by.
633 *
634 * @return The qualified class name that defines the annotation.
635 */
636 val fieldAnnotatedByClassName: String = "",
637
638 /**
639 * Define the field-annotated-by pattern by reference to a Class constant.
640 *
641 * <p>
642 * Mutually exclusive with the following other properties defining field-annotated-by:
643 * <ul>
644 * <li>fieldAnnotatedByClassName
645 * <li>fieldAnnotatedByClassNamePattern
646 * <li>memberFromBinding
647 * </ul>
648 *
649 * <p>
650 * Mutually exclusive with all method properties.
651 *
652 * <p>
653 * If none are specified the default is to match any field regardless of what the field is
654 * annotated by.
655 *
656 * @return The class-constant that defines the annotation.
657 */
658 val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
659
660 /**
661 * Define the field-annotated-by pattern by reference to a class-name pattern.
662 *
663 * <p>
664 * Mutually exclusive with the following other properties defining field-annotated-by:
665 * <ul>
666 * <li>fieldAnnotatedByClassName
667 * <li>fieldAnnotatedByClassConstant
668 * <li>memberFromBinding
669 * </ul>
670 *
671 * <p>
672 * Mutually exclusive with all method properties.
673 *
674 * <p>
675 * If none are specified the default is to match any field regardless of what the field is
676 * annotated by.
677 *
678 * @return The class-name pattern that defines the annotation.
679 */
680 val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
681
682 /**
683 * Define the field-access pattern by matching on access flags.
684 *
685 * <p>
686 * Mutually exclusive with all method properties.
687 *
688 * <p>
689 * If none, and other properties define this item as a field, the default matches any field-access
690 * flags.
691 *
692 * <p>
693 * Mutually exclusive with the property `memberFromBinding` also defining field-access.
694 *
695 * @return The field access-flag constraints that must be met.
696 */
697 val fieldAccess: Array<FieldAccessFlags> = [],
698
699 /**
700 * Define the field-name pattern by an exact field name.
701 *
702 * <p>
703 * Mutually exclusive with all method properties.
704 *
705 * <p>
706 * If none, and other properties define this item as a field, the default matches any field name.
707 *
708 * <p>
709 * Mutually exclusive with the following other properties defining field-name:
710 * <ul>
711 * <li>fieldNamePattern
712 * <li>memberFromBinding
713 * </ul>
714 *
715 * @return The exact field name of the field.
716 */
717 val fieldName: String = "",
718
719 /**
720 * Define the field-name pattern by a string pattern.
721 *
722 * <p>
723 * Mutually exclusive with all method properties.
724 *
725 * <p>
726 * If none, and other properties define this item as a field, the default matches any field name.
727 *
728 * <p>
729 * Mutually exclusive with the following other properties defining field-name:
730 * <ul>
731 * <li>fieldName
732 * <li>memberFromBinding
733 * </ul>
734 *
735 * @return The string pattern of the field name.
736 */
737 val fieldNamePattern: StringPattern = StringPattern(exact = ""),
738
739 /**
740 * Define the field-type pattern by a fully qualified type.
741 *
742 * <p>
743 * Mutually exclusive with all method properties.
744 *
745 * <p>
746 * If none, and other properties define this item as a field, the default matches any type.
747 *
748 * <p>
749 * Mutually exclusive with the following other properties defining field-type:
750 * <ul>
751 * <li>fieldTypeConstant
752 * <li>fieldTypePattern
753 * <li>memberFromBinding
754 * </ul>
755 *
756 * @return The qualified type name for the field type.
757 */
758 val fieldType: String = "",
759
760 /**
761 * Define the field-type pattern by a class constant.
762 *
763 * <p>
764 * Mutually exclusive with all method properties.
765 *
766 * <p>
767 * If none, and other properties define this item as a field, the default matches any type.
768 *
769 * <p>
770 * Mutually exclusive with the following other properties defining field-type:
771 * <ul>
772 * <li>fieldType
773 * <li>fieldTypePattern
774 * <li>memberFromBinding
775 * </ul>
776 *
777 * @return The class constant for the field type.
778 */
779 val fieldTypeConstant: KClass<*> = Object::class,
780
781 /**
782 * Define the field-type pattern by a pattern on types.
783 *
784 * <p>
785 * Mutually exclusive with all method properties.
786 *
787 * <p>
788 * If none, and other properties define this item as a field, the default matches any type.
789 *
790 * <p>
791 * Mutually exclusive with the following other properties defining field-type:
792 * <ul>
793 * <li>fieldType
794 * <li>fieldTypeConstant
795 * <li>memberFromBinding
796 * </ul>
797 *
798 * @return The type pattern for the field type.
799 */
800 val fieldTypePattern: TypePattern = TypePattern(name = ""),
801)