Refactor legacy lenses to use new NestedGraphLens

Bug: 182099754
Change-Id: If2cbce3c3c26a7886d00d918ae926b3fa935a65a
diff --git a/src/main/java/com/android/tools/r8/graph/NestedGraphLens.java b/src/main/java/com/android/tools/r8/graph/NestedGraphLens.java
index cf2e163..3d5900d 100644
--- a/src/main/java/com/android/tools/r8/graph/NestedGraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/NestedGraphLens.java
@@ -9,6 +9,8 @@
 import com.android.tools.r8.utils.IterableUtils;
 import com.android.tools.r8.utils.collections.BidirectionalManyToManyRepresentativeMap;
 import com.android.tools.r8.utils.collections.BidirectionalManyToOneRepresentativeMap;
+import com.android.tools.r8.utils.collections.EmptyBidirectionalOneToOneMap;
+import java.util.Collections;
 import java.util.Map;
 import java.util.stream.Collectors;
 
@@ -24,6 +26,12 @@
  */
 public class NestedGraphLens extends NonIdentityGraphLens {
 
+  protected static final EmptyBidirectionalOneToOneMap<DexField, DexField> EMPTY_FIELD_MAP =
+      new EmptyBidirectionalOneToOneMap<>();
+  protected static final EmptyBidirectionalOneToOneMap<DexMethod, DexMethod> EMPTY_METHOD_MAP =
+      new EmptyBidirectionalOneToOneMap<>();
+  protected static final Map<DexType, DexType> EMPTY_TYPE_MAP = Collections.emptyMap();
+
   protected final BidirectionalManyToOneRepresentativeMap<DexField, DexField> fieldMap;
   protected final Map<DexMethod, DexMethod> methodMap;
   protected final Map<DexType, DexType> typeMap;
diff --git a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
index 131ca4e..c016016 100644
--- a/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
+++ b/src/main/java/com/android/tools/r8/graph/RewrittenPrototypeDescription.java
@@ -133,8 +133,8 @@
     private final DexType oldType;
     private final DexType newType;
 
-    static RewrittenTypeInfo toVoid(DexType oldReturnType, AppView<?> appView) {
-      return new RewrittenTypeInfo(oldReturnType, appView.dexItemFactory().voidType);
+    static RewrittenTypeInfo toVoid(DexType oldReturnType, DexItemFactory dexItemFactory) {
+      return new RewrittenTypeInfo(oldReturnType, dexItemFactory.voidType);
     }
 
     public RewrittenTypeInfo(DexType oldType, DexType newType) {
@@ -150,8 +150,8 @@
       return oldType;
     }
 
-    boolean hasBeenChangedToReturnVoid(AppView<?> appView) {
-      return newType == appView.dexItemFactory().voidType;
+    boolean hasBeenChangedToReturnVoid(DexItemFactory dexItemFactory) {
+      return newType == dexItemFactory.voidType;
     }
 
     @Override
@@ -367,7 +367,9 @@
       ArgumentInfoCollection removedArgumentsInfo) {
     DexType returnType = method.proto.returnType;
     RewrittenTypeInfo returnInfo =
-        returnType.isAlwaysNull(appView) ? RewrittenTypeInfo.toVoid(returnType, appView) : null;
+        returnType.isAlwaysNull(appView)
+            ? RewrittenTypeInfo.toVoid(returnType, appView.dexItemFactory())
+            : null;
     return create(Collections.emptyList(), returnInfo, removedArgumentsInfo);
   }
 
@@ -394,8 +396,9 @@
     return extraParameters.size();
   }
 
-  public boolean hasBeenChangedToReturnVoid(AppView<?> appView) {
-    return rewrittenReturnInfo != null && rewrittenReturnInfo.hasBeenChangedToReturnVoid(appView);
+  public boolean hasBeenChangedToReturnVoid(DexItemFactory dexItemFactory) {
+    return rewrittenReturnInfo != null
+        && rewrittenReturnInfo.hasBeenChangedToReturnVoid(dexItemFactory);
   }
 
   public ArgumentInfoCollection getArgumentInfoCollection() {
@@ -444,12 +447,12 @@
   }
 
   public RewrittenPrototypeDescription withConstantReturn(
-      DexType oldReturnType, AppView<?> appView) {
+      DexType oldReturnType, DexItemFactory dexItemFactory) {
     assert rewrittenReturnInfo == null;
-    return !hasBeenChangedToReturnVoid(appView)
+    return !hasBeenChangedToReturnVoid(dexItemFactory)
         ? new RewrittenPrototypeDescription(
             extraParameters,
-            RewrittenTypeInfo.toVoid(oldReturnType, appView),
+            RewrittenTypeInfo.toVoid(oldReturnType, dexItemFactory),
             argumentInfoCollection)
         : this;
   }
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
index 321c96c..e6bc084 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
@@ -1827,7 +1827,7 @@
   public void addReturn(int value) {
     DexType returnType = method.getDefinition().returnType();
     if (returnType.isVoidType()) {
-      assert prototypeChanges.hasBeenChangedToReturnVoid(appView);
+      assert prototypeChanges.hasBeenChangedToReturnVoid(appView.dexItemFactory());
       addReturn();
     } else {
       ValueTypeConstraint returnTypeConstraint =
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java b/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
index 6ccaf0f..66e7ff7 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
@@ -280,7 +280,7 @@
                 }
 
                 ConstInstruction constantReturnMaterializingInstruction = null;
-                if (prototypeChanges.hasBeenChangedToReturnVoid(appView)
+                if (prototypeChanges.hasBeenChangedToReturnVoid(appView.dexItemFactory())
                     && invoke.outValue() != null) {
                   constantReturnMaterializingInstruction =
                       prototypeChanges.getConstantReturn(code, invoke.getPosition());
@@ -297,7 +297,7 @@
                 }
 
                 Value newOutValue =
-                    prototypeChanges.hasBeenChangedToReturnVoid(appView)
+                    prototypeChanges.hasBeenChangedToReturnVoid(appView.dexItemFactory())
                         ? null
                         : makeOutValue(invoke, code);
 
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java b/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
index 4d51361..df30aac 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
@@ -14,7 +14,7 @@
 import com.android.tools.r8.graph.DexProgramClass;
 import com.android.tools.r8.graph.DexProto;
 import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
+import com.android.tools.r8.graph.NestedGraphLens;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
@@ -28,11 +28,9 @@
 import com.android.tools.r8.utils.Timing;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneHashMap;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneMap;
-import com.android.tools.r8.utils.collections.EmptyBidirectionalOneToOneMap;
 import com.android.tools.r8.utils.collections.MutableBidirectionalOneToOneMap;
 import com.google.common.base.Equivalence.Wrapper;
 import com.google.common.collect.BiMap;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 import java.util.HashMap;
@@ -49,23 +47,15 @@
     DISALLOW_ARGUMENT_REMOVAL
   }
 
-  public static class UninstantiatedTypeOptimizationGraphLens extends LegacyNestedGraphLens {
+  public static class UninstantiatedTypeOptimizationGraphLens extends NestedGraphLens {
 
-    private final AppView<?> appView;
     private final Map<DexMethod, ArgumentInfoCollection> removedArgumentsInfoPerMethod;
 
     UninstantiatedTypeOptimizationGraphLens(
         BidirectionalOneToOneMap<DexMethod, DexMethod> methodMap,
         Map<DexMethod, ArgumentInfoCollection> removedArgumentsInfoPerMethod,
         AppView<?> appView) {
-      super(
-          ImmutableMap.of(),
-          methodMap.getForwardMap(),
-          new EmptyBidirectionalOneToOneMap<>(),
-          methodMap.getInverseOneToOneMap(),
-          appView.graphLens(),
-          appView.dexItemFactory());
-      this.appView = appView;
+      super(appView, EMPTY_FIELD_MAP, methodMap, EMPTY_TYPE_MAP);
       this.removedArgumentsInfoPerMethod = removedArgumentsInfoPerMethod;
     }
 
@@ -78,7 +68,8 @@
         return prototypeChanges;
       }
       if (method.getReturnType().isVoidType() && !previous.getReturnType().isVoidType()) {
-        prototypeChanges = prototypeChanges.withConstantReturn(previous.getReturnType(), appView);
+        prototypeChanges =
+            prototypeChanges.withConstantReturn(previous.getReturnType(), dexItemFactory());
       }
       return prototypeChanges.withRemovedArguments(
           removedArgumentsInfoPerMethod.getOrDefault(method, ArgumentInfoCollection.empty()));
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java b/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
index 6d18887..cc8f5b1 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
@@ -7,14 +7,12 @@
 import com.android.tools.r8.graph.AppView;
 import com.android.tools.r8.graph.ArgumentUse;
 import com.android.tools.r8.graph.DexEncodedMethod;
-import com.android.tools.r8.graph.DexItemFactory;
 import com.android.tools.r8.graph.DexMethod;
 import com.android.tools.r8.graph.DexProgramClass;
 import com.android.tools.r8.graph.DexProto;
 import com.android.tools.r8.graph.DexString;
 import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLens;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
+import com.android.tools.r8.graph.NestedGraphLens;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
@@ -27,10 +25,8 @@
 import com.android.tools.r8.utils.Timing;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneHashMap;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneMap;
-import com.android.tools.r8.utils.collections.EmptyBidirectionalOneToOneMap;
 import com.android.tools.r8.utils.collections.MutableBidirectionalOneToOneMap;
 import com.google.common.base.Equivalence.Wrapper;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Streams;
 import java.util.BitSet;
 import java.util.HashSet;
@@ -52,23 +48,15 @@
       new BidirectionalOneToOneHashMap<>();
   private final Map<DexMethod, ArgumentInfoCollection> removedArguments = new IdentityHashMap<>();
 
-  public static class UnusedArgumentsGraphLens extends LegacyNestedGraphLens {
+  public static class UnusedArgumentsGraphLens extends NestedGraphLens {
 
     private final Map<DexMethod, ArgumentInfoCollection> removedArguments;
 
     UnusedArgumentsGraphLens(
-        Map<DexMethod, DexMethod> methodMap,
-        BidirectionalOneToOneMap<DexMethod, DexMethod> originalMethodSignatures,
-        GraphLens previousLens,
-        DexItemFactory dexItemFactory,
+        AppView<?> appView,
+        BidirectionalOneToOneMap<DexMethod, DexMethod> methodMap,
         Map<DexMethod, ArgumentInfoCollection> removedArguments) {
-      super(
-          ImmutableMap.of(),
-          methodMap,
-          new EmptyBidirectionalOneToOneMap<>(),
-          originalMethodSignatures,
-          previousLens,
-          dexItemFactory);
+      super(appView, EMPTY_FIELD_MAP, methodMap, EMPTY_TYPE_MAP);
       this.removedArguments = removedArguments;
     }
 
@@ -103,12 +91,7 @@
     appView.appInfo().classesWithDeterministicOrder().forEach(this::processVirtualMethods);
 
     if (!methodMapping.isEmpty()) {
-      return new UnusedArgumentsGraphLens(
-          methodMapping.getForwardMap(),
-          methodMapping.getInverseOneToOneMap(),
-          appView.graphLens(),
-          appView.dexItemFactory(),
-          removedArguments);
+      return new UnusedArgumentsGraphLens(appView, methodMapping, removedArguments);
     }
 
     return null;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingLens.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingLens.java
index 4babc20..1e27370 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingLens.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingLens.java
@@ -4,12 +4,11 @@
 
 package com.android.tools.r8.ir.optimize.enums;
 
+import com.android.tools.r8.graph.AppView;
 import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.DexItemFactory;
 import com.android.tools.r8.graph.DexMethod;
 import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLens;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
+import com.android.tools.r8.graph.NestedGraphLens;
 import com.android.tools.r8.graph.RewrittenPrototypeDescription;
 import com.android.tools.r8.ir.code.Invoke;
 import com.android.tools.r8.utils.BooleanUtils;
@@ -17,34 +16,21 @@
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneMap;
 import com.android.tools.r8.utils.collections.MutableBidirectionalOneToOneMap;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
 import java.util.IdentityHashMap;
 import java.util.Map;
-import java.util.Set;
 
-class EnumUnboxingLens extends LegacyNestedGraphLens {
+class EnumUnboxingLens extends NestedGraphLens {
 
   private final Map<DexMethod, RewrittenPrototypeDescription> prototypeChangesPerMethod;
-  private final Set<DexType> unboxedEnums;
 
   EnumUnboxingLens(
-      Map<DexType, DexType> typeMap,
-      Map<DexMethod, DexMethod> methodMap,
+      AppView<?> appView,
       BidirectionalOneToOneMap<DexField, DexField> fieldMap,
-      BidirectionalOneToOneMap<DexMethod, DexMethod> originalMethodSignatures,
-      GraphLens previousLens,
-      DexItemFactory dexItemFactory,
-      Map<DexMethod, RewrittenPrototypeDescription> prototypeChangesPerMethod,
-      Set<DexType> unboxedEnums) {
-    super(
-        typeMap,
-        methodMap,
-        fieldMap,
-        originalMethodSignatures,
-        previousLens,
-        dexItemFactory);
+      BidirectionalOneToOneMap<DexMethod, DexMethod> methodMap,
+      Map<DexType, DexType> typeMap,
+      Map<DexMethod, RewrittenPrototypeDescription> prototypeChangesPerMethod) {
+    super(appView, fieldMap, methodMap, typeMap);
     this.prototypeChangesPerMethod = prototypeChangesPerMethod;
-    this.unboxedEnums = unboxedEnums;
   }
 
   @Override
@@ -60,7 +46,7 @@
   @Override
   protected Invoke.Type mapInvocationType(
       DexMethod newMethod, DexMethod originalMethod, Invoke.Type type) {
-    if (unboxedEnums.contains(originalMethod.holder)) {
+    if (typeMap.containsKey(originalMethod.getHolderType())) {
       // Methods moved from unboxed enums to the utility class are either static or statified.
       assert newMethod != originalMethod;
       return Invoke.Type.STATIC;
@@ -77,7 +63,7 @@
     protected final Map<DexType, DexType> typeMap = new IdentityHashMap<>();
     protected final MutableBidirectionalOneToOneMap<DexField, DexField> newFieldSignatures =
         new BidirectionalOneToOneHashMap<>();
-    protected final MutableBidirectionalOneToOneMap<DexMethod, DexMethod> originalMethodSignatures =
+    protected final MutableBidirectionalOneToOneMap<DexMethod, DexMethod> newMethodSignatures =
         new BidirectionalOneToOneHashMap<>();
 
     private Map<DexMethod, RewrittenPrototypeDescription> prototypeChangesPerMethod =
@@ -108,7 +94,7 @@
         boolean toStatic,
         int numberOfExtraNullParameters) {
       assert from != to;
-      originalMethodSignatures.put(to, from);
+      newMethodSignatures.put(from, to);
       int offsetDiff = 0;
       int toOffset = BooleanUtils.intValue(!toStatic);
       RewrittenPrototypeDescription.ArgumentInfoCollection.Builder builder =
@@ -141,18 +127,14 @@
               .withExtraUnusedNullParameters(numberOfExtraNullParameters));
     }
 
-    public EnumUnboxingLens build(
-        DexItemFactory dexItemFactory, GraphLens previousLens, Set<DexType> unboxedEnums) {
+    public EnumUnboxingLens build(AppView<?> appView) {
       assert !typeMap.isEmpty();
       return new EnumUnboxingLens(
-          typeMap,
-          originalMethodSignatures.getInverseOneToOneMap().getForwardMap(),
+          appView,
           newFieldSignatures,
-          originalMethodSignatures,
-          previousLens,
-          dexItemFactory,
-          ImmutableMap.copyOf(prototypeChangesPerMethod),
-          ImmutableSet.copyOf(unboxedEnums));
+          newMethodSignatures,
+          typeMap,
+          ImmutableMap.copyOf(prototypeChangesPerMethod));
     }
   }
 }
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingRewriter.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingRewriter.java
index 828d7d9..4fdd8f6 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingRewriter.java
@@ -21,7 +21,6 @@
 import com.android.tools.r8.graph.DexProgramClass;
 import com.android.tools.r8.graph.DexType;
 import com.android.tools.r8.graph.GenericSignature.MethodTypeSignature;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
 import com.android.tools.r8.graph.MethodAccessFlags;
 import com.android.tools.r8.graph.ParameterAnnotationsList;
 import com.android.tools.r8.graph.ProgramMethod;
@@ -72,7 +71,7 @@
   private final DexItemFactory factory;
   private final EnumDataMap unboxedEnumsData;
   private final UnboxedEnumMemberRelocator relocator;
-  private LegacyNestedGraphLens enumUnboxingLens;
+  private EnumUnboxingLens enumUnboxingLens;
 
   private final Map<DexMethod, DexEncodedMethod> utilityMethods = new ConcurrentHashMap<>();
 
@@ -128,7 +127,7 @@
             ENUM_UNBOXING_UTILITY_METHOD_PREFIX + "zeroCheckMessage");
   }
 
-  public void setEnumUnboxingLens(LegacyNestedGraphLens enumUnboxingLens) {
+  public void setEnumUnboxingLens(EnumUnboxingLens enumUnboxingLens) {
     this.enumUnboxingLens = enumUnboxingLens;
   }
 
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
index 31e84bb..8a43d7c 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
@@ -89,7 +89,7 @@
           DexProgramClass newHolderClass = appView.definitionFor(newHolderType).asProgramClass();
           newHolderClass.addDirectMethods(movedMethods);
         });
-    return lensBuilder.build(factory, appView.graphLens(), enumsToUnbox);
+    return lensBuilder.build(appView);
   }
 
   private void clearEnumToUnboxMethod(DexEncodedMethod enumMethod) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
index 396ffc8..c5f6ddc 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
@@ -7,24 +7,17 @@
 import com.android.tools.r8.graph.AppView;
 import com.android.tools.r8.graph.DexField;
 import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
+import com.android.tools.r8.graph.NestedGraphLens;
 import com.android.tools.r8.ir.code.Invoke.Type;
 import com.android.tools.r8.utils.collections.BidirectionalOneToOneMap;
-import com.google.common.collect.ImmutableMap;
 
-class ClassStaticizerGraphLens extends LegacyNestedGraphLens {
+class ClassStaticizerGraphLens extends NestedGraphLens {
 
   ClassStaticizerGraphLens(
       AppView<?> appView,
       BidirectionalOneToOneMap<DexField, DexField> fieldMapping,
       BidirectionalOneToOneMap<DexMethod, DexMethod> methodMapping) {
-    super(
-        ImmutableMap.of(),
-        methodMapping.getForwardMap(),
-        fieldMapping,
-        methodMapping.getInverseOneToOneMap(),
-        appView.graphLens(),
-        appView.dexItemFactory());
+    super(appView, fieldMapping, methodMapping, EMPTY_TYPE_MAP);
   }
 
   @Override
diff --git a/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java b/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
index 27fdc51..322ccb1 100644
--- a/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
+++ b/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
@@ -8,26 +8,18 @@
 import com.android.tools.r8.graph.DexEncodedMethod;
 import com.android.tools.r8.graph.DexMethod;
 import com.android.tools.r8.graph.GraphLens;
-import com.android.tools.r8.graph.LegacyNestedGraphLens;
+import com.android.tools.r8.graph.NestedGraphLens;
 import com.android.tools.r8.ir.code.Invoke.Type;
-import com.android.tools.r8.utils.collections.EmptyBidirectionalOneToOneMap;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Sets;
 import java.util.Set;
 
-final class PublicizerLens extends LegacyNestedGraphLens {
+final class PublicizerLens extends NestedGraphLens {
 
   private final AppView<?> appView;
   private final Set<DexMethod> publicizedMethods;
 
   private PublicizerLens(AppView<?> appView, Set<DexMethod> publicizedMethods) {
-    super(
-        ImmutableMap.of(),
-        ImmutableMap.of(),
-        new EmptyBidirectionalOneToOneMap<>(),
-        new EmptyBidirectionalOneToOneMap<>(),
-        appView.graphLens(),
-        appView.dexItemFactory());
+    super(appView, EMPTY_FIELD_MAP, EMPTY_METHOD_MAP, EMPTY_TYPE_MAP);
     this.appView = appView;
     this.publicizedMethods = publicizedMethods;
   }