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 | |
Eugene Susla | f745042 | 2019-11-18 16:09:52 -0800 | [diff] [blame^] | 54 | // Code below generated by codegen v1.0.14. |
Eugene Susla | 05ef53e | 2019-10-07 12:04:04 -0700 | [diff] [blame] | 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 |
Eugene Susla | f821caa | 2019-10-04 14:51:29 -0700 | [diff] [blame] | 61 | // |
| 62 | // To exclude the generated code from IntelliJ auto-formatting enable (one-time): |
| 63 | // Settings > Editor > Code Style > Formatter Control |
| 64 | //@formatter:off |
Eugene Susla | 05ef53e | 2019-10-07 12:04:04 -0700 | [diff] [blame] | 65 | |
| 66 | |
| 67 | @DataClass.Generated( |
Eugene Susla | f745042 | 2019-11-18 16:09:52 -0800 | [diff] [blame^] | 68 | time = 1574122839646L, |
| 69 | codegenVersion = "1.0.14", |
Eugene Susla | 05ef53e | 2019-10-07 12:04:04 -0700 | [diff] [blame] | 70 | sourceFile = "frameworks/base/tests/Codegen/src/com/android/codegentest/StaleDataclassDetectorFalsePositivesTest.java", |
| 71 | 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)") |
| 72 | @Deprecated |
| 73 | private void __metadata() {} |
| 74 | |
Eugene Susla | 322e8b1 | 2019-10-22 17:32:08 -0700 | [diff] [blame] | 75 | |
| 76 | //@formatter:on |
| 77 | // End of generated code |
| 78 | |
Eugene Susla | 05ef53e | 2019-10-07 12:04:04 -0700 | [diff] [blame] | 79 | } |