1 /* 2 * Copyright (C) 2016 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 dalvik.annotation; 18 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.lang.annotation.Target; 23 import java.lang.reflect.Parameter; 24 25 /** 26 * Marks the current class as a record class and stores information about its record components. 27 * 28 * <p>The annotation is allowed only on classes that are final and can be used at most once for 29 * each of these classes. 30 */ 31 @Retention(RetentionPolicy.RUNTIME) 32 @Target({ElementType.TYPE}) 33 @interface Record { 34 35 /* 36 * This annotation is never used in source code; it is expected to be generated in .dex 37 * files by tools like compilers. Commented definitions for the annotation members expected 38 * by the runtime / reflection code can be found below for reference. 39 * 40 * The arrays documented below must be the same size as for the field_id_item dex structure 41 * associated with the record class otherwise a java.lang.reflect.MalformedParametersException 42 * will be thrown at runtime. 43 */ 44 45 /* 46 * The array of component names for the record class. The array cannot be null, but can be 47 * empty. Also all values in the array must be non-null, non-empty and not contain '.', ';', '[' 48 * or '/', otherwise a java.lang.reflect.MalformedParametersException will be thrown at runtime. 49 */ 50 // String[] componentNames(); 51 52 /* 53 * The array of component types for the record class. The array cannot be null, but can be 54 * empty. All values in the array must be non-null, otherwise a 55 * java.lang.reflect.MalformedParametersException will be thrown at runtime. 56 */ 57 // Class<?>[] componentTypes(); 58 59 /* 60 * The array of {@link dalvik.annotation.Signature} attribute for each record component. 61 */ 62 // Signature[] componentSignatures(); 63 64 /* 65 * The 2D array of annotation visibilities for annotations in record component. 66 */ 67 68 // byte[][] componentAnnotationVisibilities(); 69 70 /* 71 * The 2D array of annotations. Each component can have multiple annotations. 72 */ 73 // Annotation[][] componentAnnotations(); 74 } 75 76