-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish Proguard configs as part of Guava.
Fixes #2117 RELNOTES=The published Guava jar now includes Proguard configurations that are picked up automatically by the Android Gradle Plugin. This should help with warnings that were promoted to errors in Android Gradle Plugin 8.x. PiperOrigin-RevId: 530451845
- Loading branch information
Showing
10 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Note: We intentionally don't add the flags we'd need to make Flags and Enums | ||
# work. That's because the Proguard configuration required to make them work on | ||
# optimized code would preclude lots of optimization, like converting enums | ||
# into ints. | ||
|
||
# Throwables uses internal APIs for lazy stack trace resolution | ||
-dontnote sun.misc.SharedSecrets | ||
-keep class sun.misc.SharedSecrets { | ||
*** getJavaLangAccess(...); | ||
} | ||
-dontnote sun.misc.JavaLangAccess | ||
-keep class sun.misc.JavaLangAccess { | ||
*** getStackTraceElement(...); | ||
*** getStackTraceDepth(...); | ||
} | ||
|
||
# FinalizableReferenceQueue calls this reflectively | ||
# Proguard is intelligent enough to spot the use of reflection onto this, so we | ||
# only need to keep the names, and allow it to be stripped out if | ||
# FinalizableReferenceQueue is unused. | ||
-keepnames class com.google.common.base.internal.Finalizer { | ||
*** startFinalizer(...); | ||
} | ||
# However, it cannot "spot" that this method needs to be kept IF the class is. | ||
-keepclassmembers class com.google.common.base.internal.Finalizer { | ||
*** startFinalizer(...); | ||
} | ||
-keepnames class com.google.common.base.FinalizableReference { | ||
void finalizeReferent(); | ||
} | ||
-keepclassmembers class com.google.common.base.FinalizableReference { | ||
void finalizeReferent(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Striped64 uses this | ||
-dontwarn sun.misc.Unsafe | ||
|
||
# Striped64 appears to make some assumptions about object layout that | ||
# really might not be safe. This should be investigated. | ||
-keepclassmembers class com.google.common.cache.Striped64 { | ||
*** base; | ||
*** busy; | ||
} | ||
-keepclassmembers class com.google.common.cache.Striped64$Cell { | ||
<fields>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-dontwarn java.lang.SafeVarargs | ||
|
||
# The nested FieldSettersHolder class looks these up. | ||
# | ||
# We use -keepclassmembernames because we want for ImmutableMultimap and its | ||
# fields to be stripped if it's unused: -keepclassmembernames says that, *if* | ||
# you're keeping the fields, you need to leave their names untouched. (Anyone | ||
# who is using ImmutableMultimap will certainly be using its fields. So we | ||
# don't need to worry that an ImmutableMultimap user will have the fields | ||
# optimized away.) | ||
# | ||
# This configuration is untested.... | ||
-keepclassmembernames class com.google.common.collect.ImmutableMultimap { | ||
*** map; | ||
*** size; | ||
} | ||
# similarly: | ||
-keepclassmembernames class com.google.common.collect.ConcurrentHashMultiset { | ||
*** countMap; | ||
} | ||
# similarly: | ||
-keepclassmembernames class com.google.common.collect.ImmutableSetMultimap { | ||
*** emptySet; | ||
} | ||
# similarly: | ||
-keepclassmembernames class com.google.common.collect.AbstractSortedMultiset { | ||
*** comparator; | ||
} | ||
# similarly: | ||
-keepclassmembernames class com.google.common.collect.TreeMultiset { | ||
*** range; | ||
*** rootReference; | ||
*** header; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Futures.getChecked, in both of its variants, is incompatible with proguard. | ||
|
||
# Used by AtomicReferenceFieldUpdater and sun.misc.Unsafe | ||
-keepclassmembers class com.google.common.util.concurrent.AbstractFuture** { | ||
*** waiters; | ||
*** value; | ||
*** listeners; | ||
*** thread; | ||
*** next; | ||
} | ||
-keepclassmembers class com.google.common.util.concurrent.AtomicDouble { | ||
*** value; | ||
} | ||
-keepclassmembers class com.google.common.util.concurrent.AggregateFutureState { | ||
*** remaining; | ||
*** seenExceptions; | ||
} | ||
|
||
# Since Unsafe is using the field offsets of these inner classes, we don't want | ||
# to have class merging or similar tricks applied to these classes and their | ||
# fields. It's safe to allow obfuscation, since the by-name references are | ||
# already preserved in the -keep statement above. | ||
-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFuture** { | ||
<fields>; | ||
} | ||
|
||
# AbstractFuture uses this | ||
-dontwarn sun.misc.Unsafe | ||
|
||
# MoreExecutors references AppEngine | ||
-dontnote com.google.appengine.api.ThreadManager | ||
-keep class com.google.appengine.api.ThreadManager { | ||
static *** currentRequestThreadFactory(...); | ||
} | ||
-dontnote com.google.apphosting.api.ApiProxy | ||
-keep class com.google.apphosting.api.ApiProxy { | ||
static *** getCurrentEnvironment (...); | ||
} | ||
|
||
-dontwarn java.lang.SafeVarargs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# LittleEndianByteArray uses this | ||
-dontwarn sun.misc.Unsafe | ||
|
||
# Striped64 appears to make some assumptions about object layout that | ||
# really might not be safe. This should be investigated. | ||
-keepclassmembers class com.google.common.hash.Striped64 { | ||
*** base; | ||
*** busy; | ||
} | ||
-keepclassmembers class com.google.common.hash.Striped64$Cell { | ||
<fields>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-keep class java.lang.Throwable { | ||
*** addSuppressed(...); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# UnsignedBytes uses this | ||
-dontwarn sun.misc.Unsafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Warning: common.reflect (like reflection in general) is typically slow and | ||
# unreliable under Android. We do not recommend using it. This Proguard config | ||
# exists only to avoid breaking the builds of users who already have | ||
# common.reflect in their transitive dependencies. | ||
# | ||
-dontwarn com.google.common.reflect.Invokable | ||
-dontwarn com.google.common.reflect.Invokable$ConstructorInvokable | ||
-dontwarn com.google.common.reflect.Invokable$MethodInvokable | ||
-dontwarn com.google.common.reflect.Parameter |