Eugene Susla | 05ef53e | 2019-10-07 12:04:04 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | package com.android.codegentest; |
| 17 | |
| 18 | import android.annotation.NonNull; |
| 19 | |
| 20 | import com.android.internal.util.DataClass; |
| 21 | |
| 22 | /** |
| 23 | * Test for some false positive pitfalls for |
| 24 | * {@link android.processor.staledataclass.StaleDataclassProcessor} |
| 25 | * |
| 26 | * Relies on the detector being run, failing the build should any of things here falsely |
| 27 | * register as stale. |
| 28 | */ |
| 29 | @DataClass(genConstructor = false, genBuilder = false) |
| 30 | public class StaleDataclassDetectorFalsePositivesTest { |
| 31 | |
| 32 | /** Interfaces should be ignored */ |
| 33 | public interface SomeListener { |
| 34 | void onEvent(); |
| 35 | } |
| 36 | |
| 37 | /** Enums should be ignored */ |
| 38 | private enum SomeEnum { ONE, TWO } |
| 39 | |
| 40 | /** Annotations should be ignored */ |
| 41 | public @interface SomeAnnotation {} |
| 42 | |
| 43 | /* Static initializers should be ignored */ |
| 44 | static {} |
| 45 | |
| 46 | /* Initializers should be ignored */ |
| 47 | {} |
| 48 | |
| 49 | /** Unrelated methods should be noted, without triggering staleness false positives */ |
| 50 | public @NonNull String someMethod(int param) { return null; } |
| 51 | |
| 52 | |
| 53 | |
| 54 | // Code below generated by codegen v1.0.7. |
| 55 | // |
| 56 | // DO NOT MODIFY! |
| 57 | // CHECKSTYLE:OFF Generated code |
| 58 | // |
| 59 | // To regenerate run: |
| 60 | // $ codegen $ANDROID_BUILD_TOP/frameworks/base/tests/Codegen/src/com/android/codegentest/StaleDataclassDetectorFalsePositivesTest.java |
| 61 | |
| 62 | |
| 63 | @DataClass.Generated( |
| 64 | time = 1570576457249L, |
| 65 | codegenVersion = "1.0.7", |
| 66 | sourceFile = "frameworks/base/tests/Codegen/src/com/android/codegentest/StaleDataclassDetectorFalsePositivesTest.java", |
| 67 | inputSignatures = "public @android.annotation.NonNull java.lang.String someMethod(int)\nclass StaleDataclassDetectorFalsePositivesTest extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=false)") |
| 68 | @Deprecated |
| 69 | private void __metadata() {} |
| 70 | |
| 71 | } |