OSDN Git Service

Use class retention for VisibleForTesting annotations
authorColin Cross <ccross@android.com>
Fri, 4 Aug 2017 23:39:05 +0000 (16:39 -0700)
committerColin Cross <ccross@android.com>
Fri, 4 Aug 2017 23:43:42 +0000 (16:43 -0700)
commit8e846143ddc285117d391561de7abd670078d27f
treec38393af835a263cb1a2a542715498954b33aaa5
parentf1e82787f355758066d22b383ed3186fdcc1dbae
Use class retention for VisibleForTesting annotations

The VisibleForTesting annotations are used by proguard to prevent
stripping code that is needed at runtime for tests.  The annotations
were marked with source retention, which worked fine with Jack's
proguard implementation.  When we switched back to javac + proguard,
the VisibleForTesting annotations are gone by the time proguard
sees the classes, so the annotated classes and methods can still
be stripped.

Move the VisibleForTesting annotation to class retention, which
matches guava's equivalent annotation.

Bug: 64365384
Test: m -j MtpDocumentsProvider &&
      javap -cp out/target/common/obj/APPS/MtpDocumentsProvider_intermediates/classes-proguard.jar com.android.mtp.MtpRoot

Change-Id: I63a467c2f0a21383eb9e4c9563fd6de2d994a373
core/java/com/android/internal/annotations/VisibleForTesting.java