1 /* 2 * Copyright (C) 2021 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.car.internal; 18 19 import android.annotation.IntDef; 20 21 import java.lang.annotation.ElementType; 22 import java.lang.annotation.Target; 23 24 /** 25 * Annotation used to mark code to be excluded from coverage report. 26 * 27 * @hide 28 */ 29 @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD}) 30 public @interface ExcludeFromCodeCoverageGeneratedReport { 31 32 // Reason annotation and its associated constant values 33 int DEPRECATED_CODE = 0; 34 int BOILERPLATE_CODE = 1; 35 int DUMP_INFO = 2; 36 int DEBUGGING_CODE = 3; 37 38 @IntDef(prefix = "REASON_", value = { 39 DEPRECATED_CODE, 40 BOILERPLATE_CODE, 41 DUMP_INFO, 42 DEBUGGING_CODE 43 }) 44 @interface Reason { } 45 46 /** 47 * The reason explaining why the code is being excluded from the code coverage report. 48 * <p> 49 * Possible reasons to exclude code from coverage report are: 50 * <p><ul> 51 * <li>{@link ExcludeFromCodeCoverageGeneratedReport#DEPRECATED_CODE} to exclude deprecated 52 * code from coverage report 53 * <li>{@link ExcludeFromCodeCoverageGeneratedReport#BOILERPLATE_CODE} to exclude boilerplate 54 * code like {@link java.lang.Object} methods, {@link android.os.Parcel} methods, etc 55 * <li>{@link ExcludeFromCodeCoverageGeneratedReport#DUMP_INFO} to exclude dump info methods 56 * <li>{@link ExcludeFromCodeCoverageGeneratedReport#DEBUGGING_CODE} to exclude debugging 57 * purpose 58 * code 59 * </ul><p> 60 */ reason()61 @Reason int reason(); 62 63 /** 64 * Optional field used to provide extra details about the excluded code (e.g. it can be used to 65 * tag a follow up bug). 66 */ details()67 String details() default ""; 68 } 69