Revert "Extend subtyping info after desugaring"
This reverts commit 5511e71b5d366478fd5b8aace93c9a1cb55d510d.
Revert "Account for ThrowIAE synthetics in extension of SubtypingInfo"
This reverts commit 42954bda20e1279735b23a90ab5eedbbaeb2b806.
Revert "Account for synthetic utility methods in extension of SubtypingInfo"
This reverts commit 995357d062b178827c3451587e9ba7571635a822.
Revert "Collect synthetic classes in desugaring event consumer"
This reverts commit 302e67491989989d0e1d843e9926c43400cb534d.
Bug: b/188395655
Change-Id: I6c2eaf9ec3aed47d62658496b93b509e7fddfa35
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index f6a4e93..3293b0b 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -1190,13 +1190,6 @@
SubtypingInfo subtypingInfo,
List<KeepDeclaration> keepDeclarations)
throws ExecutionException {
- timing.begin("Update subtyping info");
- subtypingInfo.unsetTypeInfo();
- if (appView.getSyntheticItems().hasPendingSyntheticClasses()) {
- subtypingInfo.extend(appView, appView.getSyntheticItems().getPendingSyntheticClasses());
- }
- assert subtypingInfo.verifyUpToDate(appView);
- timing.end();
timing.begin("Set up enqueuer");
Enqueuer enqueuer =
EnqueuerFactory.createForInitialTreeShaking(
diff --git a/src/main/java/com/android/tools/r8/graph/SubtypingInfo.java b/src/main/java/com/android/tools/r8/graph/SubtypingInfo.java
index 33fda03..1d27755 100644
--- a/src/main/java/com/android/tools/r8/graph/SubtypingInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/SubtypingInfo.java
@@ -4,9 +4,7 @@
package com.android.tools.r8.graph;
import static com.android.tools.r8.graph.DexApplication.classesWithDeterministicOrder;
-import static com.android.tools.r8.utils.MapUtils.ignoreKey;
-import com.android.tools.r8.utils.WorkList;
import com.android.tools.r8.utils.structural.StructuralItem;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -35,7 +33,7 @@
// Map from types to their subtypes.
private final Map<DexType, Set<DexType>> subtypeMap;
- private Map<DexType, TypeInfo> typeInfo;
+ private final Map<DexType, TypeInfo> typeInfo;
private final DexDefinitionSupplier definitionSupplier;
private final DexItemFactory factory;
@@ -50,36 +48,16 @@
factory = definitionSupplier.dexItemFactory();
}
- public void extend(
- AppView<? extends AppInfoWithClassHierarchy> appView, Iterable<? extends DexClass> classes) {
- assert typeInfo == null : "Extending typeInfo not implemented";
- WorkList<DexType> worklist = WorkList.newIdentityWorkList();
- for (DexClass clazz : classes) {
- worklist.addIfNotSeen(clazz.allImmediateSupertypes());
- worklist.process(
- supertype -> {
- DexClass superclass = appView.definitionFor(supertype);
- if (superclass == null) {
- return;
- }
- subtypeMap.computeIfAbsent(supertype, ignoreKey(HashSet::new)).add(clazz.getType());
- worklist.addIfNotSeen(superclass.allImmediateSupertypes());
- });
- worklist.clearSeen();
- }
- }
-
- public SubtypingInfo unsetTypeInfo() {
- typeInfo = null;
- return this;
- }
-
public static SubtypingInfo create(AppView<? extends AppInfoWithClassHierarchy> appView) {
- AppInfoWithClassHierarchy appInfo = appView.appInfo();
- DirectMappedDexApplication app = appInfo.app().asDirect();
- Iterable<DexClass> classes =
- Iterables.concat(app.programClasses(), app.classpathClasses(), app.libraryClasses());
- return create(classes, appInfo);
+ return create(appView.appInfo());
+ }
+
+ public static SubtypingInfo create(AppInfoWithClassHierarchy appInfo) {
+ DirectMappedDexApplication directApp = appInfo.app().asDirect();
+ return create(
+ Iterables.concat(
+ directApp.programClasses(), directApp.classpathClasses(), directApp.libraryClasses()),
+ appInfo);
}
public static SubtypingInfo create(
@@ -156,6 +134,7 @@
for (DexClass clazz : classes) {
populateAllSuperTypes(map, typeInfo, clazz.type, clazz, definitionSupplier);
}
+ map.replaceAll((k, v) -> ImmutableSet.copyOf(v));
assert validateLevelsAreCorrect(typeInfo, definitionSupplier);
}
@@ -254,36 +233,6 @@
return classesWithDeterministicOrder(interfaces);
}
- public boolean verifyUpToDate(AppView<AppInfoWithClassHierarchy> appView) {
- DirectMappedDexApplication app = appView.app().asDirect();
- Iterable<DexClass> classes =
- Iterables.concat(app.programClasses(), app.classpathClasses(), app.libraryClasses());
- for (DexClass clazz : classes) {
- assert verifyUpToDate(appView, clazz);
- }
- // This does not check that the `typeInfo` is up-to-date.
- assert typeInfo == null;
- return true;
- }
-
- private boolean verifyUpToDate(AppView<AppInfoWithClassHierarchy> appView, DexClass clazz) {
- WorkList<DexType> worklist = WorkList.newIdentityWorkList(clazz.allImmediateSupertypes());
- worklist.process(
- supertype -> {
- DexClass superclass = appView.definitionFor(supertype);
- if (superclass == null) {
- return;
- }
- assert subtypes(supertype).contains(clazz.getType())
- : "Expected subtypes("
- + supertype.getTypeName()
- + ") to include "
- + clazz.getTypeName();
- worklist.addIfNotSeen(superclass.allImmediateSupertypes());
- });
- return true;
- }
-
private static class TypeInfo {
private final DexType type;
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
index 30e7ab3..b0e3dab 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
@@ -10,7 +10,6 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexClassAndMethod;
import com.android.tools.r8.graph.DexClasspathClass;
@@ -433,11 +432,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- // Intentionally empty.
- }
-
- @Override
public List<ProgramMethod> finalizeDesugaring() {
List<ProgramMethod> needsProcessing = new ArrayList<>();
finalizeInvokeSpecialDesugaring(needsProcessing::add);
@@ -552,20 +546,17 @@
@Override
public void acceptDefaultAsCompanionMethod(
ProgramMethod method, ProgramMethod companionMethod) {
- additions.addSynthesizedClass(companionMethod.getHolder());
onCompanionMethodCallback.accept(method, companionMethod);
}
@Override
public void acceptPrivateAsCompanionMethod(
ProgramMethod method, ProgramMethod companionMethod) {
- additions.addSynthesizedClass(companionMethod.getHolder());
onCompanionMethodCallback.accept(method, companionMethod);
}
@Override
public void acceptStaticAsCompanionMethod(ProgramMethod method, ProgramMethod companionMethod) {
- additions.addSynthesizedClass(companionMethod.getHolder());
onCompanionMethodCallback.accept(method, companionMethod);
}
@@ -581,19 +572,12 @@
@Override
public void acceptCompanionClassClinit(ProgramMethod method, ProgramMethod companionMethod) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(companionMethod.getHolder());
- }
-
- @Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- additions.addSynthesizedClass(companionMethod.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptRecordClass(DexProgramClass recordClass) {
- // The class will be hit by tracing if required.
- additions.addSynthesizedClass(recordClass);
+ // Intentionally empty. The class will be hit by tracing if required.
}
@Override
@@ -603,21 +587,18 @@
@Override
public void acceptAutoCloseableDispatchMethod(ProgramMethod method, ProgramDefinition context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(method.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptAutoCloseableForwardingMethod(
ProgramMethod method, ProgramDefinition context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(method.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptVarHandleDesugaringClass(DexProgramClass clazz) {
- // The class will be hit by tracing if required.
- additions.addSynthesizedClass(clazz);
+ // Intentionally empty. The class will be hit by tracing if required.
}
@Override
@@ -628,8 +609,7 @@
@Override
public void acceptCollectionConversion(ProgramMethod arrayConversion, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(arrayConversion.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
@@ -660,8 +640,7 @@
@Override
public void acceptCovariantRetargetMethod(ProgramMethod method, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(method.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
@@ -708,8 +687,7 @@
@SuppressWarnings("UnusedVariable")
private void acceptUtilityMethod(ProgramMethod method, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(method.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
@@ -718,7 +696,6 @@
// The method will be hit by tracing if required.
// Pin the synthetic so it is not inlined again.
additions.addMinimumSyntheticKeepInfo(method, Joiner::disallowInlining);
- additions.addSynthesizedClass(method.getHolder());
}
@Override
@@ -727,7 +704,6 @@
// The method will be hit by tracing if required.
// Pin the synthetic so it is not inlined again.
additions.addMinimumSyntheticKeepInfo(method, Joiner::disallowInlining);
- additions.addSynthesizedClass(method.getHolder());
}
@Override
@@ -747,32 +723,27 @@
@Override
public void acceptAPIConversionOutline(ProgramMethod method, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(method.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptBackportedMethod(ProgramMethod backportedMethod, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(backportedMethod.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptBackportedClass(DexProgramClass backportedClass, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(backportedClass);
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptTypeSwitchMethod(ProgramMethod typeSwitchMethod, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(typeSwitchMethod.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
public void acceptTypeSwitchClass(DexProgramClass typeSwitchClass, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(typeSwitchClass);
+ // Intentionally empty. The method will be hit by tracing if required.
}
@Override
@@ -784,7 +755,6 @@
@Override
public void acceptLambdaClass(LambdaClass lambdaClass, ProgramMethod context) {
- additions.addSynthesizedClass(lambdaClass.getLambdaProgramClass());
synchronized (synthesizedLambdaClasses) {
synthesizedLambdaClasses.put(lambdaClass, context);
}
@@ -796,7 +766,6 @@
@Override
public void acceptConstantDynamicClass(
ConstantDynamicClass constantDynamicClass, ProgramMethod context) {
- additions.addSynthesizedClass(constantDynamicClass.getConstantDynamicProgramClass());
synchronized (synthesizedConstantDynamicClasses) {
synthesizedConstantDynamicClasses.add(constantDynamicClass);
}
@@ -817,7 +786,7 @@
ProgramMethod bridge,
DexClass argumentClass,
DexClassAndMethod context) {
- additions.addSynthesizedClass(argumentClass);
+ // Intentionally empty.
}
@Override
@@ -900,8 +869,7 @@
@Override
public void acceptOutlinedMethod(ProgramMethod outlinedMethod, ProgramMethod context) {
- // The method will be hit by tracing if required.
- additions.addSynthesizedClass(outlinedMethod.getHolder());
+ // Intentionally empty. The method will be hit by tracing if required.
}
}
@@ -1016,11 +984,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- assert false;
- }
-
- @Override
public void acceptDefaultAsCompanionMethod(
ProgramMethod method, ProgramMethod companionMethod) {
assert false;
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceDesugaringSyntheticHelper.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceDesugaringSyntheticHelper.java
index 08a42f4..c47d004 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceDesugaringSyntheticHelper.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceDesugaringSyntheticHelper.java
@@ -376,8 +376,7 @@
ClasspathOrLibraryClass context = method.getHolder().asClasspathOrLibraryClass();
DexMethod companionMethodReference =
defaultAsMethodOfCompanionClass(method.getReference(), appView.dexItemFactory());
- return ensureMethodOfClasspathCompanionClassStub(
- companionMethodReference, context, appView, eventConsumer);
+ return ensureMethodOfClasspathCompanionClassStub(companionMethodReference, context, appView);
}
DexClassAndMethod ensureStaticAsMethodOfCompanionClassStub(
@@ -388,8 +387,7 @@
} else {
ClasspathOrLibraryClass context = method.getHolder().asClasspathOrLibraryClass();
DexMethod companionMethodReference = staticAsMethodOfCompanionClass(method);
- return ensureMethodOfClasspathCompanionClassStub(
- companionMethodReference, context, appView, eventConsumer);
+ return ensureMethodOfClasspathCompanionClassStub(companionMethodReference, context, appView);
}
}
@@ -492,10 +490,7 @@
}
private static DexClassAndMethod ensureMethodOfClasspathCompanionClassStub(
- DexMethod companionMethodReference,
- ClasspathOrLibraryClass context,
- AppView<?> appView,
- InterfaceMethodDesugaringBaseEventConsumer eventConsumer) {
+ DexMethod companionMethodReference, ClasspathOrLibraryClass context, AppView<?> appView) {
return appView
.getSyntheticItems()
.ensureFixedClasspathClassMethod(
@@ -509,8 +504,7 @@
methodBuilder ->
methodBuilder
.setAccessFlags(MethodAccessFlags.createPublicStaticSynthetic())
- .setCode(ignore -> ThrowNullCode.get()),
- eventConsumer::acceptCompanionClasspathMethod);
+ .setCode(ignore -> ThrowNullCode.get()));
}
ProgramMethod ensureStaticAsMethodOfProgramCompanionClassStub(
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringBaseEventConsumer.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringBaseEventConsumer.java
index 440ede3..76f0d7c 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringBaseEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringBaseEventConsumer.java
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.ir.desugar.itf;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.ProgramMethod;
public interface InterfaceMethodDesugaringBaseEventConsumer {
@@ -15,6 +14,4 @@
void acceptPrivateAsCompanionMethod(ProgramMethod method, ProgramMethod companionMethod);
void acceptStaticAsCompanionMethod(ProgramMethod method, ProgramMethod companionMethod);
-
- void acceptCompanionClasspathMethod(ClasspathMethod companionMethod);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringEventConsumer.java
index 530c001..8f537f9 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodDesugaringEventConsumer.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.ir.desugar.itf;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.ProgramMethod;
public interface InterfaceMethodDesugaringEventConsumer
@@ -32,11 +31,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- // Intentionally empty.
- }
-
- @Override
public void acceptDefaultAsCompanionMethod(
ProgramMethod method, ProgramMethod companionMethod) {
// Intentionally empty.
diff --git a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
index 9b5401f..d549537 100644
--- a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
@@ -7,7 +7,6 @@
import static com.android.tools.r8.profile.rewriting.ProfileRewritingVarHandleDesugaringEventConsumerUtils.handleVarHandleDesugaringClassContext;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexClassAndMethod;
import com.android.tools.r8.graph.DexClasspathClass;
@@ -116,11 +115,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- parent.acceptCompanionClasspathMethod(companionMethod);
- }
-
- @Override
public void acceptConstantDynamicClass(
ConstantDynamicClass constantDynamicClass, ProgramMethod context) {
if (appView.options().getArtProfileOptions().isIncludingConstantDynamicClass()) {
diff --git a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingRootSetBuilderEventConsumer.java b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingRootSetBuilderEventConsumer.java
index f4a84b6..22691ca 100644
--- a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingRootSetBuilderEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingRootSetBuilderEventConsumer.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.profile.rewriting;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.shaking.RootSetBuilderEventConsumer;
@@ -35,11 +34,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- parent.acceptCompanionClasspathMethod(companionMethod);
- }
-
- @Override
public void acceptDefaultAsCompanionMethod(ProgramMethod method, ProgramMethod companionMethod) {
additionsCollection.addMethodAndHolderIfContextIsInProfile(companionMethod, method);
parent.acceptDefaultAsCompanionMethod(method, companionMethod);
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index 2faa630..15a2384 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -174,7 +174,6 @@
import com.android.tools.r8.utils.collections.ProgramMethodSet;
import com.android.tools.r8.utils.timing.Timing;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import it.unimi.dsi.fastutil.objects.Object2BooleanArrayMap;
@@ -4118,8 +4117,6 @@
private final Map<DexProgramClass, Set<DexClass>> injectedInterfaces =
new ConcurrentHashMap<>();
- private final Set<DexClass> synthesizedClasses = ConcurrentHashMap.newKeySet();
-
SyntheticAdditions(ProcessorContext processorContext) {
this.processorContext = processorContext;
}
@@ -4134,8 +4131,7 @@
desugaredMethods.isEmpty()
&& liveMethods.isEmpty()
&& syntheticClasspathClasses.isEmpty()
- && injectedInterfaces.isEmpty()
- && synthesizedClasses.isEmpty();
+ && injectedInterfaces.isEmpty();
return empty;
}
@@ -4171,10 +4167,6 @@
method, ignoreKey(KeepMethodInfo::newEmptyJoiner)));
}
- public void addSynthesizedClass(DexClass clazz) {
- synthesizedClasses.add(clazz);
- }
-
void enqueueWorkItems(Enqueuer enqueuer) {
assert enqueuer.mode.isInitialTreeShaking();
@@ -4219,11 +4211,7 @@
// Commit the pending synthetics and recompute subtypes.
appInfo = timing.time("Rebuild AppInfo", () -> appInfo.rebuildWithClassHierarchy(app -> app));
appView.setAppInfo(appInfo);
- subtypingInfo.extend(
- appView,
- Iterables.concat(
- additions.synthesizedClasses, additions.syntheticClasspathClasses.values()));
- assert subtypingInfo.verifyUpToDate(appView);
+ subtypingInfo = timing.time("Create SubtypingInfo", () -> SubtypingInfo.create(appView));
// Finally once all synthesized items "exist" it is now safe to continue tracing. The new work
// items are enqueued and the fixed point will continue once this subroutine returns.
diff --git a/src/main/java/com/android/tools/r8/shaking/RootSetBuilderEventConsumer.java b/src/main/java/com/android/tools/r8/shaking/RootSetBuilderEventConsumer.java
index 47cf17a..6bf84a6 100644
--- a/src/main/java/com/android/tools/r8/shaking/RootSetBuilderEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/shaking/RootSetBuilderEventConsumer.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.shaking;
-import com.android.tools.r8.graph.ClasspathMethod;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.desugar.itf.InterfaceMethodDesugaringBaseEventConsumer;
import com.android.tools.r8.profile.rewriting.ProfileCollectionAdditions;
@@ -37,11 +36,6 @@
}
@Override
- public void acceptCompanionClasspathMethod(ClasspathMethod companionMethod) {
- // Intentionally empty.
- }
-
- @Override
public void acceptDefaultAsCompanionMethod(
ProgramMethod method, ProgramMethod companionMethod) {
// Intentionally empty.
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
index 3a29cde..e15699a 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
@@ -981,39 +981,11 @@
Consumer<SyntheticClasspathClassBuilder> classConsumer,
Consumer<DexClasspathClass> onCreationConsumer,
Consumer<SyntheticMethodBuilder> buildMethodCallback) {
- return ensureFixedClasspathMethodFromType(
- methodName,
- methodProto,
- kindSelector,
- contextType,
- appView,
- classConsumer,
- onCreationConsumer,
- buildMethodCallback,
- emptyConsumer());
- }
-
- public ClasspathMethod ensureFixedClasspathMethodFromType(
- DexString methodName,
- DexProto methodProto,
- SyntheticKindSelector kindSelector,
- DexType contextType,
- AppView<?> appView,
- Consumer<SyntheticClasspathClassBuilder> classConsumer,
- Consumer<DexClasspathClass> onCreationConsumer,
- Consumer<SyntheticMethodBuilder> buildMethodCallback,
- Consumer<ClasspathMethod> newMethodCallback) {
DexClasspathClass clazz =
ensureFixedClasspathClassFromType(
kindSelector, contextType, appView, classConsumer, onCreationConsumer);
return internalEnsureFixedClasspathMethod(
- methodName,
- methodProto,
- kindSelector.select(naming),
- appView,
- buildMethodCallback,
- newMethodCallback,
- clazz);
+ methodName, methodProto, kindSelector.select(naming), appView, buildMethodCallback, clazz);
}
public ClasspathMethod ensureFixedClasspathClassMethod(
@@ -1025,39 +997,11 @@
Consumer<SyntheticClasspathClassBuilder> buildClassCallback,
Consumer<DexClasspathClass> onClassCreationCallback,
Consumer<SyntheticMethodBuilder> buildMethodCallback) {
- return ensureFixedClasspathClassMethod(
- methodName,
- methodProto,
- kindSelector,
- context,
- appView,
- buildClassCallback,
- onClassCreationCallback,
- buildMethodCallback,
- emptyConsumer());
- }
-
- public ClasspathMethod ensureFixedClasspathClassMethod(
- DexString methodName,
- DexProto methodProto,
- SyntheticKindSelector kindSelector,
- ClasspathOrLibraryClass context,
- AppView<?> appView,
- Consumer<SyntheticClasspathClassBuilder> buildClassCallback,
- Consumer<DexClasspathClass> onClassCreationCallback,
- Consumer<SyntheticMethodBuilder> buildMethodCallback,
- Consumer<ClasspathMethod> newMethodCallback) {
DexClasspathClass clazz =
ensureFixedClasspathClass(
kindSelector, context, appView, buildClassCallback, onClassCreationCallback);
return internalEnsureFixedClasspathMethod(
- methodName,
- methodProto,
- kindSelector.select(naming),
- appView,
- buildMethodCallback,
- newMethodCallback,
- clazz);
+ methodName, methodProto, kindSelector.select(naming), appView, buildMethodCallback, clazz);
}
private ClasspathMethod internalEnsureFixedClasspathMethod(
@@ -1066,7 +1010,6 @@
SyntheticKind kind,
AppView<?> appView,
Consumer<SyntheticMethodBuilder> buildMethodCallback,
- Consumer<ClasspathMethod> newMethodCallback,
DexClasspathClass clazz) {
DexMethod methodReference =
appView.dexItemFactory().createMethod(clazz.getType(), methodProto, methodName);
@@ -1082,9 +1025,7 @@
buildMethodCallback.accept(methodBuilder.disableAndroidApiLevelCheck());
},
emptyConsumer());
- ClasspathMethod method = new ClasspathMethod(clazz, methodDefinition);
- newMethodCallback.accept(method);
- return method;
+ return new ClasspathMethod(clazz, methodDefinition);
}
@SuppressWarnings("unchecked")