[Retrace] Canonicalize synthetic mapping information
Change-Id: I2f14682675f793748c5870ad58f99103f3daa187
diff --git a/src/main/java/com/android/tools/r8/naming/mappinginformation/CompilerSynthesizedMappingInformation.java b/src/main/java/com/android/tools/r8/naming/mappinginformation/CompilerSynthesizedMappingInformation.java
index 8ddef2b..48baf2f 100644
--- a/src/main/java/com/android/tools/r8/naming/mappinginformation/CompilerSynthesizedMappingInformation.java
+++ b/src/main/java/com/android/tools/r8/naming/mappinginformation/CompilerSynthesizedMappingInformation.java
@@ -13,24 +13,19 @@
public class CompilerSynthesizedMappingInformation extends ReferentialMappingInformation {
+ private static final CompilerSynthesizedMappingInformation INSTANCE =
+ new CompilerSynthesizedMappingInformation();
public static final MapVersion SUPPORTED_VERSION = MapVersion.MAP_VERSION_1_0;
public static final String ID = "com.android.tools.r8.synthesized";
- public static class Builder {
-
- public CompilerSynthesizedMappingInformation build() {
- return new CompilerSynthesizedMappingInformation();
- }
- }
-
public static boolean isSupported(MapVersion version) {
return version.isGreaterThanOrEqualTo(SUPPORTED_VERSION);
}
private CompilerSynthesizedMappingInformation() {}
- public static Builder builder() {
- return new Builder();
+ public static CompilerSynthesizedMappingInformation getInstance() {
+ return INSTANCE;
}
@Override
@@ -70,7 +65,7 @@
MapVersion version,
Consumer<MappingInformation> onMappingInfo) {
if (isSupported(version)) {
- onMappingInfo.accept(builder().build());
+ onMappingInfo.accept(getInstance());
}
}
}
diff --git a/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java b/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
index c0a65b6..07d684b 100644
--- a/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
+++ b/src/main/java/com/android/tools/r8/utils/positions/MappedPositionToClassNameMapperBuilder.java
@@ -162,7 +162,7 @@
if (syntheticItems.isSyntheticClass(clazz)) {
getBuilder()
.addMappingInformation(
- CompilerSynthesizedMappingInformation.builder().build(), Unreachable::raise);
+ CompilerSynthesizedMappingInformation.getInstance(), Unreachable::raise);
}
return this;
}
@@ -201,8 +201,7 @@
if (method.getDefinition().isD8R8Synthesized()
|| (!mappedPositions.isEmpty()
&& mappedPositions.get(0).getPosition().isD8R8Synthesized())) {
- methodSpecificMappingInformation.add(
- CompilerSynthesizedMappingInformation.builder().build());
+ methodSpecificMappingInformation.add(CompilerSynthesizedMappingInformation.getInstance());
}
DexMethod residualMethod =