diff options
Diffstat (limited to 'src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java')
-rw-r--r-- | src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java b/src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java index 37cdb34de..4a288bec3 100644 --- a/src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java +++ b/src/main/java/com/android/tools/r8/naming/MemberNameMinifier.java @@ -7,6 +7,7 @@ import com.android.tools.r8.graph.AppInfoWithSubtyping; import com.android.tools.r8.graph.CachedHashValueDexItem; import com.android.tools.r8.graph.DexString; import com.android.tools.r8.graph.DexType; +import com.android.tools.r8.shaking.ProguardConfiguration; import com.android.tools.r8.shaking.RootSetBuilder.RootSet; import com.android.tools.r8.utils.InternalOptions; import com.google.common.collect.ImmutableList; @@ -21,25 +22,27 @@ abstract class MemberNameMinifier<MemberType, StateType extends CachedHashValueD protected final ImmutableList<String> dictionary; protected final Map<MemberType, DexString> renaming = new IdentityHashMap<>(); - protected final Map<DexType, NamingState<StateType>> states = new IdentityHashMap<>(); - protected final NamingState<StateType> globalState; + protected final Map<DexType, NamingState<StateType, ?>> states = new IdentityHashMap<>(); + protected final NamingState<StateType, ?> globalState; protected final boolean useUniqueMemberNames; MemberNameMinifier(AppInfoWithSubtyping appInfo, RootSet rootSet, InternalOptions options) { this.appInfo = appInfo; this.rootSet = rootSet; this.dictionary = options.proguardConfiguration.getObfuscationDictionary(); - - this.globalState = NamingState.createRoot(appInfo.dexItemFactory, dictionary); + this.globalState = NamingState.createRoot(appInfo.dexItemFactory, dictionary, + getKeyTransform(options.proguardConfiguration)); this.useUniqueMemberNames = options.proguardConfiguration.isUseUniqueClassMemberNames(); } - protected NamingState<StateType> computeStateIfAbsent( - DexType type, Function<DexType, NamingState<StateType>> f) { + abstract Function<StateType, ?> getKeyTransform(ProguardConfiguration config); + + protected NamingState<StateType, ?> computeStateIfAbsent( + DexType type, Function<DexType, NamingState<StateType, ?>> f) { return useUniqueMemberNames ? globalState : states.computeIfAbsent(type, f); } - protected NamingState<StateType> getState(DexType type) { + protected NamingState<StateType, ?> getState(DexType type) { return useUniqueMemberNames ? globalState : states.get(type); } } |