Revert "Search private method overrides in classpath when compiling with nest support."
Bug: 142087235
This reverts commit 841b5a801177cda55047d52f858a5cfea0a0bedb.
Reason for revert: not needed
Change-Id: Ieb7e2f2eeb61067228c1f7db34d6a9f143c59daf
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 4fa19b6..08f3cc3 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -1564,39 +1564,28 @@
assert libraryClass.isNotProgramClass();
assert !instantiatedClass.isInterface() || instantiatedClass.accessFlags.isAnnotation();
for (DexEncodedMethod method : libraryClass.virtualMethods()) {
- markLibraryAndClasspathMethodOverridesAsLive(libraryClass, instantiatedClass, method);
- }
- // When compiling with nest-based access private methods are also possible targets.
- if (options.canUseNestBasedAccess() && libraryClass.isClasspathClass()) {
- for (DexEncodedMethod method : libraryClass.directMethods()) {
- markLibraryAndClasspathMethodOverridesAsLive(libraryClass, instantiatedClass, method);
- }
- }
- }
-
- private void markLibraryAndClasspathMethodOverridesAsLive(
- DexClass libraryClass, DexProgramClass instantiatedClass, DexEncodedMethod method) {
- // Note: it may be worthwhile to add a resolution cache here. If so, it must still ensure
- // that all library override edges are reported to the kept-graph consumer.
- ResolutionResult resolution =
- appView.appInfo().resolveMethod(instantiatedClass, method.method);
- if (resolution.isValidVirtualTarget(options)) {
- resolution.forEachTarget(
- target -> {
- if (!target.isAbstract()) {
- DexClass targetHolder = appView.definitionFor(target.method.holder);
- if (targetHolder != null && targetHolder.isProgramClass()) {
- DexProgramClass programClass = targetHolder.asProgramClass();
- if (shouldMarkLibraryMethodOverrideAsReachable(programClass, target)) {
- target.setLibraryMethodOverride();
- markVirtualMethodAsLive(
- programClass,
- target,
- KeepReason.isLibraryMethod(programClass, libraryClass.type));
+ // Note: it may be worthwhile to add a resolution cache here. If so, it must till ensure
+ // that all library override edges are reported to the kept-graph consumer.
+ ResolutionResult resolution =
+ appView.appInfo().resolveMethod(instantiatedClass, method.method);
+ if (resolution.isValidVirtualTarget(options)) {
+ resolution.forEachTarget(
+ target -> {
+ if (!target.isAbstract()) {
+ DexClass targetHolder = appView.definitionFor(target.method.holder);
+ if (targetHolder != null && targetHolder.isProgramClass()) {
+ DexProgramClass programClass = targetHolder.asProgramClass();
+ if (shouldMarkLibraryMethodOverrideAsReachable(programClass, target)) {
+ target.setLibraryMethodOverride();
+ markVirtualMethodAsLive(
+ programClass,
+ target,
+ KeepReason.isLibraryMethod(programClass, libraryClass.type));
+ }
}
}
- }
- });
+ });
+ }
}
}