From e0ae96368c966d1fb5f8ad3de852050c95621a79 Mon Sep 17 00:00:00 2001 From: Paco Estevez Garcia Date: Fri, 28 Aug 2020 06:30:53 -0700 Subject: [PATCH] Add DoNotStripAny Summary: This diff adds an annotation that also prevents stripping methods, fields and static blocks. This is necessary for D23373168 to be OSS'd Reviewed By: SidharthGuglani Differential Revision: D23395925 fbshipit-source-id: 8456234cb75b15ae87580835e76f8e251ba09a9b --- .../proguard/annotations/DoNotStripAny.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStripAny.java diff --git a/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStripAny.java b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStripAny.java new file mode 100644 index 00000000..48f71f2b --- /dev/null +++ b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStripAny.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.proguard.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.CLASS; + +/** + * Add this annotation to a class to instruct Proguard to not strip it or any of its fields or + * methods out. + * + *

This is useful for methods called via reflection that could appear as unused to Proguard. + */ +@Target({ElementType.TYPE}) +@Retention(CLASS) +public @interface DoNotStripAny {}