Rename mayBeMinified to mayNotBeMinified to reflect use

The method will return true if we cannot minify the reference.

Change-Id: I18d7feac4010d066e509a477aafdc6eebdb1f3b3
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/ClassInitializerDefaultsOptimization.java b/src/main/java/com/android/tools/r8/ir/optimize/ClassInitializerDefaultsOptimization.java
index ba62429..45ca27a 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/ClassInitializerDefaultsOptimization.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/ClassInitializerDefaultsOptimization.java
@@ -279,7 +279,7 @@
       return null;
     }
 
-    if (appView.options().isMinifying() && !appView.rootSet().mayBeMinified(holder, appView)) {
+    if (appView.options().isMinifying() && appView.rootSet().mayBeMinified(holder, appView)) {
       if (invokedMethod == dexItemFactory.classMethods.getName) {
         return new DexItemBasedValueString(holder, new ClassNameComputationInfo(NAME));
       }
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java b/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
index cf405c9..4ef87bd 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/string/StringOptimizer.java
@@ -275,7 +275,7 @@
       DexString name = null;
       if (invokedMethod == factory.classMethods.getName) {
         if (appView.options().isMinifying()
-            && !appView.rootSet().mayBeMinified(holder.type, appView)) {
+            && appView.rootSet().mayBeMinified(holder.type, appView)) {
           deferred =
               new DexItemBasedConstString(
                   invoke.outValue(),
@@ -300,7 +300,7 @@
             continue;
           }
           if (appView.options().isMinifying()
-              && !appView.rootSet().mayBeMinified(holder.type, appView)) {
+              && appView.rootSet().mayBeMinified(holder.type, appView)) {
             deferred =
                 new DexItemBasedConstString(
                     invoke.outValue(),
@@ -322,7 +322,7 @@
             continue;
           }
           if (appView.options().isMinifying()
-              && !appView.rootSet().mayBeMinified(holder.type, appView)) {
+              && appView.rootSet().mayBeMinified(holder.type, appView)) {
             deferred =
                 new DexItemBasedConstString(
                     invoke.outValue(),
diff --git a/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java b/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
index 3c7bd2f..aeac240 100644
--- a/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
@@ -114,7 +114,7 @@
       return true;
     }
     if (!appView.options().getProguardConfiguration().hasApplyMappingFile()
-        && appView.rootSet().mayBeMinified(field.field, appView)) {
+        && appView.rootSet().mayNotBeMinified(field.field, appView)) {
       return true;
     }
     return false;
diff --git a/src/main/java/com/android/tools/r8/naming/FieldNamingState.java b/src/main/java/com/android/tools/r8/naming/FieldNamingState.java
index 7916e8a..38d429d 100644
--- a/src/main/java/com/android/tools/r8/naming/FieldNamingState.java
+++ b/src/main/java/com/android/tools/r8/naming/FieldNamingState.java
@@ -57,7 +57,7 @@
         return field.name;
       }
       if (!appView.options().getProguardConfiguration().hasApplyMappingFile()
-          && appView.rootSet().mayBeMinified(encodedField.field, appView)) {
+          && appView.rootSet().mayNotBeMinified(encodedField.field, appView)) {
         return field.name;
       }
     }
diff --git a/src/main/java/com/android/tools/r8/naming/Minifier.java b/src/main/java/com/android/tools/r8/naming/Minifier.java
index fdf6f93..a122093 100644
--- a/src/main/java/com/android/tools/r8/naming/Minifier.java
+++ b/src/main/java/com/android/tools/r8/naming/Minifier.java
@@ -107,7 +107,7 @@
 
     @Override
     public boolean noObfuscation(DexType type) {
-      return appView.rootSet().mayBeMinified(type, appView);
+      return appView.rootSet().mayNotBeMinified(type, appView);
     }
   }
 
@@ -171,7 +171,7 @@
 
     @Override
     public boolean noObfuscation(DexReference reference) {
-      return appView.rootSet().mayBeMinified(reference, appView);
+      return appView.rootSet().mayNotBeMinified(reference, appView);
     }
   }
 }
diff --git a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
index 95aaf35..e6584a8 100644
--- a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
+++ b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
@@ -111,7 +111,7 @@
       boolean wasSeen = methodPoolCollection.markIfNotSeen(holder, encodedMethod.method);
       if (wasSeen) {
         // We can't do anything further because even renaming is not allowed due to the keep rule.
-        if (appView.rootSet().mayBeMinified(encodedMethod.method, appView)) {
+        if (appView.rootSet().mayNotBeMinified(encodedMethod.method, appView)) {
           return false;
         }
         // TODO(b/111118390): Renaming will enable more private instance methods to be publicized.
diff --git a/src/main/java/com/android/tools/r8/shaking/RootSetBuilder.java b/src/main/java/com/android/tools/r8/shaking/RootSetBuilder.java
index 4249b72..c32d23f 100644
--- a/src/main/java/com/android/tools/r8/shaking/RootSetBuilder.java
+++ b/src/main/java/com/android/tools/r8/shaking/RootSetBuilder.java
@@ -1192,6 +1192,10 @@
     }
 
     public boolean mayBeMinified(DexReference reference, AppView<?> appView) {
+      return !mayNotBeMinified(reference, appView);
+    }
+
+    public boolean mayNotBeMinified(DexReference reference, AppView<?> appView) {
       if (reference.isDexType()) {
         return noObfuscation.contains(
             appView.graphLense().getOriginalType(reference.asDexType()));
diff --git a/src/main/java/com/android/tools/r8/shaking/TreePruner.java b/src/main/java/com/android/tools/r8/shaking/TreePruner.java
index 588b90d..ba63b85 100644
--- a/src/main/java/com/android/tools/r8/shaking/TreePruner.java
+++ b/src/main/java/com/android/tools/r8/shaking/TreePruner.java
@@ -121,7 +121,7 @@
         // If the class is a local class, it'll become an ordinary class by renaming.
         // Invalidate its inner-class / enclosing-method attributes early.
         if (appView.options().isMinifying()
-            && !appView.rootSet().mayBeMinified(clazz.type, appView)
+            && appView.rootSet().mayBeMinified(clazz.type, appView)
             && clazz.isLocalClass()) {
           assert clazz.getEnclosingMethod() != null;
           assert clazz.getInnerClassAttributeForThisClass() != null;