Revert "Add D8R8SynthesizedFlag"
This reverts commit 1838d75e2c287cf0d185c69ac89e05b759d342c1.
Reason for revert: red tests
Change-Id: Idb091b045fb3799f47addd81580d994db2502270
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
index d7dc501..39977cc 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
@@ -137,7 +137,7 @@
private CompilationState compilationState = CompilationState.NOT_PROCESSED;
private MethodOptimizationInfo optimizationInfo = DefaultMethodOptimizationInfo.DEFAULT_INSTANCE;
private CallSiteOptimizationInfo callSiteOptimizationInfo = CallSiteOptimizationInfo.BOTTOM;
- private int classFileVersion;
+ private int classFileVersion = -1;
private DexEncodedMethod defaultInterfaceMethodImplementation = null;
@@ -151,18 +151,6 @@
// Any newly added `public` method should check if `this` instance is obsolete.
private boolean obsolete = false;
- // This flag indicates if the method has been synthesized by D8/R8. Such method do not require
- // a proguard mapping file entry. This flag is different from the synthesized access flag. When a
- // non synthesized method is inlined into a synthesized method, the method no longer has the
- // synthesized access flag, but the d8R8Synthesized flag is still there. Methods can also have
- // the synthesized access flag prior to D8/R8 compilation, in which case d8R8Synthesized is not
- // set.
- private final boolean d8R8Synthesized;
-
- public boolean isD8R8Synthesized() {
- return d8R8Synthesized;
- }
-
private void checkIfObsolete() {
assert !obsolete;
}
@@ -212,49 +200,26 @@
DexAnnotationSet annotations,
ParameterAnnotationsList parameterAnnotationsList,
Code code) {
- this(method, accessFlags, annotations, parameterAnnotationsList, code, -1);
- }
-
- public DexEncodedMethod(
- DexMethod method,
- MethodAccessFlags accessFlags,
- DexAnnotationSet annotations,
- ParameterAnnotationsList parameterAnnotationsList,
- Code code,
- int classFileVersion) {
- this(method, accessFlags, annotations, parameterAnnotationsList, code, classFileVersion, false);
- }
-
- public DexEncodedMethod(
- DexMethod method,
- MethodAccessFlags accessFlags,
- DexAnnotationSet annotations,
- ParameterAnnotationsList parameterAnnotationsList,
- Code code,
- boolean d8R8Synthesized) {
- this(method, accessFlags, annotations, parameterAnnotationsList, code, -1, d8R8Synthesized);
- }
-
- public DexEncodedMethod(
- DexMethod method,
- MethodAccessFlags accessFlags,
- DexAnnotationSet annotations,
- ParameterAnnotationsList parameterAnnotationsList,
- Code code,
- int classFileVersion,
- boolean d8R8Synthesized) {
this.method = method;
this.accessFlags = accessFlags;
this.annotations = annotations;
this.parameterAnnotationsList = parameterAnnotationsList;
this.code = code;
- this.classFileVersion = classFileVersion;
- this.d8R8Synthesized = d8R8Synthesized;
-
assert code == null || !shouldNotHaveCode();
assert parameterAnnotationsList != null;
}
+ public DexEncodedMethod(
+ DexMethod method,
+ MethodAccessFlags flags,
+ DexAnnotationSet annotationSet,
+ ParameterAnnotationsList annotationsList,
+ Code code,
+ int classFileVersion) {
+ this(method, flags, annotationSet, annotationsList, code);
+ this.classFileVersion = classFileVersion;
+ }
+
public OptionalBool isLibraryMethodOverride() {
return isNonPrivateVirtualMethod() ? isLibraryMethodOverride : OptionalBool.FALSE;
}
@@ -944,11 +909,23 @@
return builder.build();
}
+ public DexEncodedMethod toRenamedMethod(DexString name, DexItemFactory factory) {
+ checkIfObsolete();
+ if (method.name == name) {
+ return this;
+ }
+ DexMethod newMethod = factory.createMethod(method.holder, method.proto, name);
+ Builder builder = builder(this);
+ builder.setMethod(newMethod);
+ setObsolete();
+ return builder.build();
+ }
+
public DexEncodedMethod toInitializerForwardingBridge(DexClass holder, DexMethod newMethod) {
assert accessFlags.isPrivate()
: "Expected to create bridge for private constructor as part of nest-based access"
+ " desugaring";
- Builder builder = syntheticBuilder(this);
+ Builder builder = builder(this);
builder.setMethod(newMethod);
ForwardMethodSourceCode.Builder forwardSourceCodeBuilder =
ForwardMethodSourceCode.builder(newMethod);
@@ -996,12 +973,7 @@
}
});
return new DexEncodedMethod(
- newMethod,
- accessFlags,
- DexAnnotationSet.empty(),
- ParameterAnnotationsList.empty(),
- code,
- true);
+ newMethod, accessFlags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code);
}
public DexEncodedMethod toRenamedHolderMethod(DexType newHolderType, DexItemFactory factory) {
@@ -1025,18 +997,13 @@
interfaceType, companionMethod, libraryMethod, extraDispatchCases, appView)
.generateCfCode();
return new DexEncodedMethod(
- newMethod,
- accessFlags,
- DexAnnotationSet.empty(),
- ParameterAnnotationsList.empty(),
- code,
- true);
+ newMethod, accessFlags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code);
}
public DexEncodedMethod toStaticForwardingBridge(DexClass holder, DexMethod newMethod) {
assert accessFlags.isPrivate()
: "Expected to create bridge for private method as part of nest-based access desugaring";
- Builder builder = syntheticBuilder(this);
+ Builder builder = builder(this);
builder.setMethod(newMethod);
ForwardMethodSourceCode.Builder forwardSourceCodeBuilder =
ForwardMethodSourceCode.builder(newMethod);
@@ -1074,7 +1041,7 @@
DexMethod newMethod =
definitions.dexItemFactory().createMethod(holder.type, method.proto, method.name);
Invoke.Type type = accessFlags.isStatic() ? Invoke.Type.STATIC : Invoke.Type.SUPER;
- Builder builder = syntheticBuilder(this);
+ Builder builder = builder(this);
builder.setMethod(newMethod);
if (accessFlags.isAbstract()) {
// If the forwarding target is abstract, we can just create an abstract method. While it
@@ -1131,8 +1098,7 @@
newFlags,
target.annotations,
target.parameterAnnotationsList,
- new SynthesizedCode(forwardSourceCodeBuilder::build),
- true);
+ new SynthesizedCode(forwardSourceCodeBuilder::build));
}
public DexEncodedMethod toStaticMethodWithoutThis() {
@@ -1266,10 +1232,6 @@
}
}
- private static Builder syntheticBuilder(DexEncodedMethod from) {
- return new Builder(from, true);
- }
-
private static Builder builder(DexEncodedMethod from) {
return new Builder(from);
}
@@ -1284,13 +1246,8 @@
private CompilationState compilationState;
private MethodOptimizationInfo optimizationInfo;
private final int classFileVersion;
- private boolean d8R8Synthesized;
private Builder(DexEncodedMethod from) {
- this(from, from.d8R8Synthesized);
- }
-
- private Builder(DexEncodedMethod from, boolean d8R8Synthesized) {
// Copy all the mutable state of a DexEncodedMethod here.
method = from.method;
accessFlags = from.accessFlags.copy();
@@ -1299,7 +1256,6 @@
compilationState = from.compilationState;
optimizationInfo = from.optimizationInfo.mutableCopy();
classFileVersion = from.classFileVersion;
- this.d8R8Synthesized = d8R8Synthesized;
if (from.parameterAnnotationsList.isEmpty()
|| from.parameterAnnotationsList.size() == method.proto.parameters.size()) {
@@ -1385,13 +1341,7 @@
|| parameterAnnotations.size() == method.proto.parameters.size();
DexEncodedMethod result =
new DexEncodedMethod(
- method,
- accessFlags,
- annotations,
- parameterAnnotations,
- code,
- classFileVersion,
- d8R8Synthesized);
+ method, accessFlags, annotations, parameterAnnotations, code, classFileVersion);
result.compilationState = compilationState;
result.optimizationInfo = optimizationInfo;
return result;
diff --git a/src/main/java/com/android/tools/r8/graph/GraphLense.java b/src/main/java/com/android/tools/r8/graph/GraphLense.java
index 09a9055..1fc834d 100644
--- a/src/main/java/com/android/tools/r8/graph/GraphLense.java
+++ b/src/main/java/com/android/tools/r8/graph/GraphLense.java
@@ -719,8 +719,10 @@
: "Unable to map field `" + field.field.toSourceString() + "` back to original program";
}
for (DexEncodedMethod method : clazz.methods()) {
- if (method.isD8R8Synthesized()) {
- // Methods synthesized by D8/R8 may not be mapped.
+ if (method.accessFlags.isSynthetic()) {
+ // This could be a bridge that has been inserted, for example, as a result of member
+ // rebinding. Consider only skipping the check below for methods that have been
+ // synthesized by R8.
continue;
}
DexMethod originalMethod = getOriginalMethodSignature(method.method);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
index 8c632a2..1da29d2 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
@@ -214,7 +214,7 @@
Code code = provider.generateTemplateMethod(appView.options(), method);
DexEncodedMethod dexEncodedMethod =
new DexEncodedMethod(
- method, flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code, true);
+ method, flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code);
boolean addToMainDexList =
referencingClasses.stream()
.anyMatch(clazz -> appView.appInfo().isInMainDexList(clazz.type));
@@ -392,7 +392,7 @@
factory.createMethod(
interfaceType, emulatedDispatchMethod.proto, emulatedDispatchMethod.name);
return new DexEncodedMethod(
- newMethod, flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), null, true);
+ newMethod, flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), null);
}
private DexEncodedMethod generateHolderDispatchMethod(
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
index 0204455..565af2f 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
@@ -365,8 +365,7 @@
new SynthesizedCode(
callerPosition ->
new ExceptionThrowingSourceCode(
- clazz.type, method, callerPosition, dexItemFactory.icceType)),
- true);
+ clazz.type, method, callerPosition, dexItemFactory.icceType)));
addSyntheticMethod(clazz.asProgramClass(), newEncodedMethod);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/CovariantReturnTypeAnnotationTransformer.java b/src/main/java/com/android/tools/r8/ir/desugar/CovariantReturnTypeAnnotationTransformer.java
index a0fb1c8..e13f26f 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/CovariantReturnTypeAnnotationTransformer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/CovariantReturnTypeAnnotationTransformer.java
@@ -164,8 +164,7 @@
newAccessFlags,
method.annotations.keepIf(x -> !isCovariantReturnTypeAnnotation(x.annotation)),
method.parameterAnnotationsList.keepIf(Predicates.alwaysTrue()),
- new SynthesizedCode(forwardSourceCodeBuilder::build),
- true);
+ new SynthesizedCode(forwardSourceCodeBuilder::build));
// Optimize to generate DexCode instead of SynthesizedCode.
converter.optimizeSynthesizedMethod(newVirtualMethod);
return newVirtualMethod;
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryWrapperSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryWrapperSynthesizer.java
index bf48a16..e3e7ab0 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryWrapperSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryWrapperSynthesizer.java
@@ -403,8 +403,7 @@
newFlags,
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- code,
- true);
+ code);
}
private List<DexEncodedMethod> allImplementedMethods(DexClass libraryClass) {
@@ -475,8 +474,7 @@
accessFlags,
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- code,
- true);
+ code);
}
// Wrapper finalization section.
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
index ccb0f3c..9599834 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
@@ -94,7 +94,7 @@
DexEncodedMethod.setDebugInfoWithFakeThisParameter(
code, companionMethod.getArity(), appView);
DexEncodedMethod implMethod = new DexEncodedMethod(
- companionMethod, newFlags, virtual.annotations, virtual.parameterAnnotationsList, code, true);
+ companionMethod, newFlags, virtual.annotations, virtual.parameterAnnotationsList, code);
virtual.setDefaultInterfaceMethodImplementation(implMethod);
companionMethods.add(implMethod);
graphLensBuilder.move(virtual.method, implMethod.method);
@@ -128,7 +128,7 @@
+ "either be public or private in " + iface.origin;
DexMethod companionMethod = rewriter.staticAsMethodOfCompanionClass(oldMethod);
companionMethods.add(new DexEncodedMethod(companionMethod, newFlags,
- direct.annotations, direct.parameterAnnotationsList, direct.getCode(),true));
+ direct.annotations, direct.parameterAnnotationsList, direct.getCode()));
graphLensBuilder.move(oldMethod, companionMethod);
} else {
if (originalFlags.isPrivate()) {
@@ -147,7 +147,7 @@
DexEncodedMethod.setDebugInfoWithFakeThisParameter(
code, companionMethod.getArity(), appView);
companionMethods.add(new DexEncodedMethod(companionMethod,
- newFlags, direct.annotations, direct.parameterAnnotationsList, code,true));
+ newFlags, direct.annotations, direct.parameterAnnotationsList, code));
graphLensBuilder.move(oldMethod, companionMethod);
} else {
// Since there are no interface constructors at this point,
@@ -247,8 +247,7 @@
Constants.ACC_PUBLIC | Constants.ACC_STATIC | Constants.ACC_SYNTHETIC, false),
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new SynthesizedCode(forwardSourceCodeBuilder::build),
- true);
+ new SynthesizedCode(forwardSourceCodeBuilder::build));
newEncodedMethod.getMutableOptimizationInfo().markNeverInline();
dispatchMethods.add(newEncodedMethod);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
index 4d5239f..ce77849 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaClass.java
@@ -218,8 +218,7 @@
Constants.ACC_PUBLIC | Constants.ACC_FINAL, false),
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new LambdaMainMethodSynthesizedCode(this, mainMethod),
- true);
+ new LambdaMainMethodSynthesizedCode(this, mainMethod));
// Synthesize bridge methods.
for (DexProto bridgeProto : descriptor.bridges) {
@@ -235,8 +234,7 @@
false),
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new LambdaBridgeMethodSynthesizedCode(this, mainMethod, bridgeMethod),
- true);
+ new LambdaBridgeMethodSynthesizedCode(this, mainMethod, bridgeMethod));
}
return methods;
}
@@ -256,8 +254,7 @@
true),
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new LambdaConstructorSynthesizedCode(this),
- true);
+ new LambdaConstructorSynthesizedCode(this));
// Class constructor for stateless lambda classes.
if (stateless) {
@@ -268,8 +265,7 @@
Constants.ACC_SYNTHETIC | Constants.ACC_STATIC, true),
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new LambdaClassConstructorSynthesizedCode(this),
- true);
+ new LambdaClassConstructorSynthesizedCode(this));
}
return methods;
}
@@ -586,8 +582,7 @@
newAccessFlags,
encodedMethod.annotations,
encodedMethod.parameterAnnotationsList,
- encodedMethod.getCode(),
- true);
+ encodedMethod.getCode());
newMethod.copyMetadata(encodedMethod);
rewriter.methodMapping.put(encodedMethod.method, callTarget);
@@ -631,8 +626,7 @@
newAccessFlags,
encodedMethod.annotations,
encodedMethod.parameterAnnotationsList,
- encodedMethod.getCode(),
- true);
+ encodedMethod.getCode());
newMethod.copyMetadata(encodedMethod);
rewriter.methodMapping.put(encodedMethod.method, callTarget);
// Move the method from the direct methods to the virtual methods set.
@@ -672,8 +666,7 @@
ParameterAnnotationsList.empty(),
new SynthesizedCode(
callerPosition ->
- new AccessorMethodSourceCode(LambdaClass.this, callerPosition)),
- true);
+ new AccessorMethodSourceCode(LambdaClass.this, callerPosition)));
// We may arrive here concurrently so we need must update the methods of the class atomically.
synchronized (accessorClass) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
index 4c2a36d..cf66050 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
@@ -40,7 +40,7 @@
public abstract class NestBasedAccessDesugaring {
// Short names to avoid creating long strings
- public static final String NEST_ACCESS_NAME_PREFIX = "-$$Nest$";
+ private static final String NEST_ACCESS_NAME_PREFIX = "-$$Nest$";
private static final String NEST_ACCESS_METHOD_NAME_PREFIX = NEST_ACCESS_NAME_PREFIX + "m";
private static final String NEST_ACCESS_STATIC_METHOD_NAME_PREFIX =
NEST_ACCESS_NAME_PREFIX + "sm";
@@ -69,7 +69,6 @@
}
DexType getNestConstructorType() {
- assert nestConstructor != null;
return nestConstructor.type;
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
index 17250cf..817fdb2 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
@@ -134,7 +134,7 @@
MethodAccessFlags flags = MethodAccessFlags.fromSharedAccessFlags(
Constants.ACC_PUBLIC | Constants.ACC_STATIC | Constants.ACC_SYNTHETIC, false);
DexEncodedMethod method = new DexEncodedMethod(twrCloseResourceMethod,
- flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code, true);
+ flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), code);
// Create utility class.
DexProgramClass utilityClass =
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
index ab3274d..6de35d0 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
@@ -971,12 +971,11 @@
classInitializationAnalysis.notifyCodeHasChanged();
strategy.updateTypeInformationIfNeeded(inlinee.code, blockIterator, block);
- // The synthetic and bridge flags are maintained only if the inlinee has also these flags.
- if (context.accessFlags.isBridge() && !inlinee.code.method.accessFlags.isBridge()) {
- context.accessFlags.unsetBridge();
- }
- if (context.accessFlags.isSynthetic() && !inlinee.code.method.accessFlags.isSynthetic()) {
+ // TODO(b/146114533): Fix inlining in synthetic methods.
+ // If we inlined the invoke from a bridge method, it is no longer a bridge method.
+ if (context.accessFlags.isBridge()) {
context.accessFlags.unsetSynthetic();
+ context.accessFlags.unsetBridge();
}
context.copyMetadata(singleTarget);
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
index e17e419..2ac3abd 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
@@ -1343,8 +1343,7 @@
methodAccess,
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- new OutlineCode(outline),
- true);
+ new OutlineCode(outline));
if (appView.options().isGeneratingClassFiles()) {
direct[count].upgradeClassFileVersion(sites.get(0).getClassFileVersion());
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/ServiceLoaderRewriter.java b/src/main/java/com/android/tools/r8/ir/optimize/ServiceLoaderRewriter.java
index 856baa9..29ad438 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/ServiceLoaderRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/ServiceLoaderRewriter.java
@@ -225,8 +225,7 @@
methodAccess,
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
- ServiceLoaderSourceCode.generate(serviceType, classes, appView.dexItemFactory()),
- true);
+ ServiceLoaderSourceCode.generate(serviceType, classes, appView.dexItemFactory()));
synthesizedClass.addDirectMethod(encodedMethod);
return encodedMethod;
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/lambda/kotlin/KotlinLambdaGroupClassBuilder.java b/src/main/java/com/android/tools/r8/ir/optimize/lambda/kotlin/KotlinLambdaGroupClassBuilder.java
index 6bc95f2..74a5236 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/lambda/kotlin/KotlinLambdaGroupClassBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/lambda/kotlin/KotlinLambdaGroupClassBuilder.java
@@ -127,8 +127,7 @@
method,
group.getLambdaIdField(factory),
implMethods,
- callerPosition)),
- true));
+ callerPosition))));
}
}
@@ -178,8 +177,7 @@
new SynthesizedCode(
callerPosition ->
createInstanceInitializerSourceCode(
- groupClassType, initializerMethod, callerPosition)),
- true);
+ groupClassType, initializerMethod, callerPosition)));
// Static class initializer for stateless lambdas.
if (needsSingletonInstances) {
@@ -196,8 +194,7 @@
ParameterAnnotationsList.empty(),
new SynthesizedCode(
callerPosition ->
- new ClassInitializerSourceCode(method, factory, group, callerPosition)),
- true);
+ new ClassInitializerSourceCode(method, factory, group, callerPosition)));
}
return result;
diff --git a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
index ae8eb7e..c518937 100644
--- a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
+++ b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
@@ -1214,8 +1214,7 @@
DexAnnotationSet.empty(),
ParameterAnnotationsList.empty(),
code,
- method.hasClassFileVersion() ? method.getClassFileVersion() : -1,
- true);
+ method.hasClassFileVersion() ? method.getClassFileVersion() : -1);
if (method.accessFlags.isPromotedToPublic()) {
// The bridge is now the public method serving the role of the original method, and should
// reflect that this method was publicized.
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/MinimumNumberOfBridgesGenerated.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/MinimumNumberOfBridgesGenerated.java
index 9d01c91..8322b11 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/MinimumNumberOfBridgesGenerated.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/MinimumNumberOfBridgesGenerated.java
@@ -12,8 +12,6 @@
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper.DexVm;
-import com.android.tools.r8.graph.DexEncodedMethod;
-import com.android.tools.r8.ir.desugar.NestBasedAccessDesugaring;
import com.android.tools.r8.utils.codeinspector.ClassSubject;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import com.android.tools.r8.utils.codeinspector.FoundMethodSubject;
@@ -60,30 +58,19 @@
int methodNumBridges = parameters.isCfRuntime() ? 0 : 2;
ClassSubject methodMainClass = inspector.clazz(getMainClass("methods"));
assertEquals(
- methodNumBridges, methodMainClass.allMethods(this::isNestBridge).size());
+ methodNumBridges, methodMainClass.allMethods(FoundMethodSubject::isSynthetic).size());
// Two bridges for method and staticMethod.
int constructorNumBridges = parameters.isCfRuntime() ? 0 : 1;
ClassSubject constructorMainClass = inspector.clazz(getMainClass("constructors"));
assertEquals(
constructorNumBridges,
- constructorMainClass.allMethods(this::isNestBridge).size());
+ constructorMainClass.allMethods(FoundMethodSubject::isSynthetic).size());
// Four bridges for field and staticField, both get & set.
int fieldNumBridges = parameters.isCfRuntime() ? 0 : 4;
ClassSubject fieldMainClass = inspector.clazz(getMainClass("fields"));
assertEquals(
- fieldNumBridges, fieldMainClass.allMethods(this::isNestBridge).size());
- }
-
- private boolean isNestBridge(FoundMethodSubject methodSubject) {
- DexEncodedMethod method = methodSubject.getMethod();
- if (method.isInstanceInitializer()) {
- return method.method.proto.parameters.size() > 0 && method.method.proto.parameters.values[
- method.method.proto.parameters.size() - 1].toSourceString()
- .contains(NestBasedAccessDesugaring.NEST_CONSTRUCTOR_NAME);
- }
- return method.method.name.toString()
- .startsWith(NestBasedAccessDesugaring.NEST_ACCESS_NAME_PREFIX);
+ fieldNumBridges, fieldMainClass.allMethods(FoundMethodSubject::isSynthetic).size());
}
}