Switch from library configuration to specifications
- rename classes and variables only.
- initial step before introducing new specifications
Bug: 184026720
Change-Id: I79a4b8addd4258c7891efad6865d197e4087f78b
diff --git a/src/main/java/com/android/tools/r8/BackportedMethodListCommand.java b/src/main/java/com/android/tools/r8/BackportedMethodListCommand.java
index 61caf95..bce73f0 100644
--- a/src/main/java/com/android/tools/r8/BackportedMethodListCommand.java
+++ b/src/main/java/com/android/tools/r8/BackportedMethodListCommand.java
@@ -4,8 +4,8 @@
package com.android.tools.r8;
import com.android.tools.r8.graph.DexItemFactory;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.AndroidApp;
@@ -41,7 +41,7 @@
private final boolean printVersion;
private final Reporter reporter;
private final int minApiLevel;
- private final DesugaredLibraryConfiguration desugaredLibraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final AndroidApp app;
private final StringConsumer backportedMethodListConsumer;
private final DexItemFactory factory;
@@ -62,8 +62,8 @@
return minApiLevel;
}
- public DesugaredLibraryConfiguration getDesugaredLibraryConfiguration() {
- return desugaredLibraryConfiguration;
+ public LegacyDesugaredLibrarySpecification getDesugaredLibraryConfiguration() {
+ return desugaredLibrarySpecification;
}
public StringConsumer getBackportedMethodListConsumer() {
@@ -79,7 +79,7 @@
this.printVersion = printVersion;
this.reporter = new Reporter();
this.minApiLevel = -1;
- this.desugaredLibraryConfiguration = null;
+ this.desugaredLibrarySpecification = null;
this.app = null;
this.backportedMethodListConsumer = null;
this.factory = null;
@@ -88,7 +88,7 @@
private BackportedMethodListCommand(
Reporter reporter,
int minApiLevel,
- DesugaredLibraryConfiguration desugaredLibraryConfiguration,
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification,
AndroidApp app,
StringConsumer backportedMethodListConsumer,
DexItemFactory factory) {
@@ -96,7 +96,7 @@
this.printVersion = false;
this.reporter = reporter;
this.minApiLevel = minApiLevel;
- this.desugaredLibraryConfiguration = desugaredLibraryConfiguration;
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.app = app;
this.backportedMethodListConsumer = backportedMethodListConsumer;
this.factory = factory;
@@ -105,7 +105,7 @@
InternalOptions getInternalOptions() {
InternalOptions options = new InternalOptions(factory, getReporter());
options.setMinApiLevel(AndroidApiLevel.getAndroidApiLevel(minApiLevel));
- options.desugaredLibraryConfiguration = desugaredLibraryConfiguration;
+ options.desugaredLibrarySpecification = desugaredLibrarySpecification;
return options;
}
@@ -178,7 +178,7 @@
private final Reporter reporter;
private int minApiLevel = AndroidApiLevel.B.getLevel();
- private List<StringResource> desugaredLibraryConfigurationResources = new ArrayList<>();
+ private List<StringResource> desugaredLibrarySpecificationResources = new ArrayList<>();
private final AndroidApp.Builder app;
private StringConsumer backportedMethodListConsumer;
private boolean printHelp = false;
@@ -215,7 +215,7 @@
/** Desugared library configuration */
public Builder addDesugaredLibraryConfiguration(StringResource configuration) {
- desugaredLibraryConfigurationResources.add(configuration);
+ desugaredLibrarySpecificationResources.add(configuration);
return this;
}
@@ -245,18 +245,18 @@
return this;
}
- DesugaredLibraryConfiguration getDesugaredLibraryConfiguration(DexItemFactory factory) {
- if (desugaredLibraryConfigurationResources.isEmpty()) {
- return DesugaredLibraryConfiguration.empty();
+ LegacyDesugaredLibrarySpecification getDesugaredLibraryConfiguration(DexItemFactory factory) {
+ if (desugaredLibrarySpecificationResources.isEmpty()) {
+ return LegacyDesugaredLibrarySpecification.empty();
}
- if (desugaredLibraryConfigurationResources.size() > 1) {
+ if (desugaredLibrarySpecificationResources.size() > 1) {
reporter.fatalError("Only one desugared library configuration is supported.");
}
- StringResource desugaredLibraryConfigurationResource =
- desugaredLibraryConfigurationResources.get(0);
- DesugaredLibraryConfigurationParser libraryParser =
- new DesugaredLibraryConfigurationParser(factory, null, false, getMinApiLevel());
- return libraryParser.parse(desugaredLibraryConfigurationResource);
+ StringResource desugaredLibrarySpecificationResource =
+ desugaredLibrarySpecificationResources.get(0);
+ LegacyDesugaredLibrarySpecificationParser libraryParser =
+ new LegacyDesugaredLibrarySpecificationParser(factory, null, false, getMinApiLevel());
+ return libraryParser.parse(desugaredLibrarySpecificationResource);
}
/** Output file for the backported method list */
@@ -306,7 +306,7 @@
public BackportedMethodListCommand build() {
AndroidApp library = app.build();
- if (!desugaredLibraryConfigurationResources.isEmpty()
+ if (!desugaredLibrarySpecificationResources.isEmpty()
&& library.getLibraryResourceProviders().isEmpty()) {
reporter.error(
new StringDiagnostic("With desugared library configuration a library is required"));
diff --git a/src/main/java/com/android/tools/r8/BaseCompilerCommand.java b/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
index 4af2547..18b7c02 100644
--- a/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
+++ b/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
@@ -7,8 +7,8 @@
import com.android.tools.r8.errors.Unreachable;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.inspector.Inspector;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.AndroidApp;
@@ -224,7 +224,7 @@
private int minApiLevel = 0;
private int threadCount = ThreadUtils.NOT_SPECIFIED;
protected DesugarState desugarState = DesugarState.ON;
- private List<StringResource> desugaredLibraryConfigurationResources = new ArrayList<>();
+ private List<StringResource> desugaredLibrarySpecificationResources = new ArrayList<>();
private boolean includeClassesChecksum = false;
private boolean lookupLibraryBeforeProgram = true;
private boolean optimizeMultidexForLinearAlloc = false;
@@ -562,35 +562,35 @@
/** Desugared library configuration */
// Configuration "default" is for testing only and support will be dropped.
public B addDesugaredLibraryConfiguration(String configuration) {
- this.desugaredLibraryConfigurationResources.add(
+ this.desugaredLibrarySpecificationResources.add(
StringResource.fromString(configuration, Origin.unknown()));
return self();
}
/** Desugared library configuration */
public B addDesugaredLibraryConfiguration(StringResource configuration) {
- this.desugaredLibraryConfigurationResources.add(configuration);
+ this.desugaredLibrarySpecificationResources.add(configuration);
return self();
}
- DesugaredLibraryConfiguration getDesugaredLibraryConfiguration(
+ LegacyDesugaredLibrarySpecification getDesugaredLibraryConfiguration(
DexItemFactory factory, boolean libraryCompilation) {
- if (desugaredLibraryConfigurationResources.isEmpty()) {
- return DesugaredLibraryConfiguration.empty();
+ if (desugaredLibrarySpecificationResources.isEmpty()) {
+ return LegacyDesugaredLibrarySpecification.empty();
}
- if (desugaredLibraryConfigurationResources.size() > 1) {
+ if (desugaredLibrarySpecificationResources.size() > 1) {
throw new CompilationError("Only one desugared library configuration is supported.");
}
- StringResource desugaredLibraryConfigurationResource =
- desugaredLibraryConfigurationResources.get(0);
- DesugaredLibraryConfigurationParser libraryParser =
- new DesugaredLibraryConfigurationParser(
+ StringResource desugaredLibrarySpecificationResource =
+ desugaredLibrarySpecificationResources.get(0);
+ LegacyDesugaredLibrarySpecificationParser libraryParser =
+ new LegacyDesugaredLibrarySpecificationParser(
factory, getReporter(), libraryCompilation, getMinApiLevel());
- return libraryParser.parse(desugaredLibraryConfigurationResource);
+ return libraryParser.parse(desugaredLibrarySpecificationResource);
}
boolean hasDesugaredLibraryConfiguration() {
- return !desugaredLibraryConfigurationResources.isEmpty();
+ return !desugaredLibrarySpecificationResources.isEmpty();
}
/** Encodes checksum for each class when generating dex files. */
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index c7240f8..3b3e48e 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -169,7 +169,7 @@
AndroidApp inputApp, InternalOptions options, ExecutorService executor, Timing timing)
throws IOException {
PrefixRewritingMapper rewritePrefix =
- options.desugaredLibraryConfiguration.getPrefixRewritingMapper();
+ options.desugaredLibrarySpecification.getPrefixRewritingMapper();
ApplicationReader applicationReader = new ApplicationReader(inputApp, options, timing);
LazyLoadedDexApplication app = applicationReader.read(executor);
AppInfo appInfo = AppInfo.createInitialAppInfo(app, applicationReader.readMainDexClasses(app));
diff --git a/src/main/java/com/android/tools/r8/D8Command.java b/src/main/java/com/android/tools/r8/D8Command.java
index 8d0f357..d667575 100644
--- a/src/main/java/com/android/tools/r8/D8Command.java
+++ b/src/main/java/com/android/tools/r8/D8Command.java
@@ -12,7 +12,7 @@
import com.android.tools.r8.horizontalclassmerging.HorizontalClassMerger;
import com.android.tools.r8.inspector.Inspector;
import com.android.tools.r8.inspector.internal.InspectorImpl;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.shaking.ProguardConfigurationParser;
import com.android.tools.r8.shaking.ProguardConfigurationRule;
@@ -288,7 +288,7 @@
intermediate |= getProgramConsumer() instanceof DexFilePerClassFileConsumer;
DexItemFactory factory = new DexItemFactory();
- DesugaredLibraryConfiguration libraryConfiguration =
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
getDesugaredLibraryConfiguration(factory, false);
ImmutableList<ProguardConfigurationRule> mainDexKeepRules =
@@ -308,7 +308,7 @@
getDexClassChecksumFilter(),
getDesugarGraphConsumer(),
desugaredLibraryKeepRuleConsumer,
- libraryConfiguration,
+ desugaredLibrarySpecification,
getAssertionsConfiguration(),
getOutputInspections(),
synthesizedClassPrefix,
@@ -328,7 +328,7 @@
private final boolean intermediate;
private final DesugarGraphConsumer desugarGraphConsumer;
private final StringConsumer desugaredLibraryKeepRuleConsumer;
- private final DesugaredLibraryConfiguration libraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final String synthesizedClassPrefix;
private final boolean skipDump;
private final boolean enableMainDexListCheck;
@@ -390,7 +390,7 @@
BiPredicate<String, Long> dexClassChecksumFilter,
DesugarGraphConsumer desugarGraphConsumer,
StringConsumer desugaredLibraryKeepRuleConsumer,
- DesugaredLibraryConfiguration libraryConfiguration,
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification,
List<AssertionsConfiguration> assertionsConfiguration,
List<Consumer<Inspector>> outputInspections,
String synthesizedClassPrefix,
@@ -422,7 +422,7 @@
this.intermediate = intermediate;
this.desugarGraphConsumer = desugarGraphConsumer;
this.desugaredLibraryKeepRuleConsumer = desugaredLibraryKeepRuleConsumer;
- this.libraryConfiguration = libraryConfiguration;
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.synthesizedClassPrefix = synthesizedClassPrefix;
this.skipDump = skipDump;
this.enableMainDexListCheck = enableMainDexListCheck;
@@ -436,7 +436,7 @@
intermediate = false;
desugarGraphConsumer = null;
desugaredLibraryKeepRuleConsumer = null;
- libraryConfiguration = null;
+ desugaredLibrarySpecification = null;
synthesizedClassPrefix = null;
skipDump = false;
enableMainDexListCheck = true;
@@ -500,7 +500,7 @@
internal.dexClassChecksumFilter = getDexClassChecksumFilter();
internal.enableInheritanceClassInDexDistributor = isOptimizeMultidexForLinearAlloc();
- internal.desugaredLibraryConfiguration = libraryConfiguration;
+ internal.desugaredLibrarySpecification = desugaredLibrarySpecification;
internal.synthesizedClassPrefix = synthesizedClassPrefix;
internal.desugaredLibraryKeepRuleConsumer = desugaredLibraryKeepRuleConsumer;
@@ -528,7 +528,7 @@
dumpBaseCommandOptions(builder);
return builder
.setIntermediate(intermediate)
- .setDesugaredLibraryConfiguration(libraryConfiguration)
+ .setDesugaredLibraryConfiguration(desugaredLibrarySpecification)
.setMainDexKeepRules(mainDexKeepRules)
.build();
}
diff --git a/src/main/java/com/android/tools/r8/DumpOptions.java b/src/main/java/com/android/tools/r8/DumpOptions.java
index 14ae9c6..c7f3345 100644
--- a/src/main/java/com/android/tools/r8/DumpOptions.java
+++ b/src/main/java/com/android/tools/r8/DumpOptions.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.dex.Marker.Tool;
import com.android.tools.r8.experimental.startup.StartupConfiguration;
import com.android.tools.r8.features.FeatureSplitConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.shaking.ProguardConfiguration;
import com.android.tools.r8.shaking.ProguardConfigurationRule;
import com.android.tools.r8.utils.InternalOptions.DesugarState;
@@ -50,7 +50,7 @@
private final Optional<Boolean> forceProguardCompatibility;
// Dump if present.
- private final DesugaredLibraryConfiguration desugaredLibraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final FeatureSplitConfiguration featureSplitConfiguration;
private final ProguardConfiguration proguardConfiguration;
private final List<ProguardConfigurationRule> mainDexKeepRules;
@@ -62,7 +62,7 @@
Tool tool,
CompilationMode compilationMode,
int minAPI,
- DesugaredLibraryConfiguration desugaredLibraryConfiguration,
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification,
boolean optimizeMultidexForLinearAlloc,
int threadCount,
DesugarState desugarState,
@@ -78,7 +78,7 @@
this.tool = tool;
this.compilationMode = compilationMode;
this.minApi = minAPI;
- this.desugaredLibraryConfiguration = desugaredLibraryConfiguration;
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.optimizeMultidexForLinearAlloc = optimizeMultidexForLinearAlloc;
this.threadCount = threadCount;
this.desugarState = desugarState;
@@ -133,13 +133,13 @@
}
private boolean hasDesugaredLibraryConfiguration() {
- return desugaredLibraryConfiguration != null
- && !desugaredLibraryConfiguration.isEmptyConfiguration();
+ return desugaredLibrarySpecification != null
+ && !desugaredLibrarySpecification.isEmptyConfiguration();
}
public String getDesugaredLibraryJsonSource() {
if (hasDesugaredLibraryConfiguration()) {
- return desugaredLibraryConfiguration.getJsonSource();
+ return desugaredLibrarySpecification.getJsonSource();
}
return null;
}
@@ -186,7 +186,7 @@
private Optional<Boolean> minification = Optional.empty();
private Optional<Boolean> forceProguardCompatibility = Optional.empty();
// Dump if present.
- private DesugaredLibraryConfiguration desugaredLibraryConfiguration;
+ private LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private FeatureSplitConfiguration featureSplitConfiguration;
private ProguardConfiguration proguardConfiguration;
private List<ProguardConfigurationRule> mainDexKeepRules;
@@ -209,8 +209,8 @@
}
public Builder setDesugaredLibraryConfiguration(
- DesugaredLibraryConfiguration desugaredLibraryConfiguration) {
- this.desugaredLibraryConfiguration = desugaredLibraryConfiguration;
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification) {
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
return this;
}
@@ -280,7 +280,7 @@
tool,
compilationMode,
minApi,
- desugaredLibraryConfiguration,
+ desugaredLibrarySpecification,
optimizeMultidexForLinearAlloc,
threadCount,
desugarState,
diff --git a/src/main/java/com/android/tools/r8/GenerateLintFiles.java b/src/main/java/com/android/tools/r8/GenerateLintFiles.java
index cde20fa..660b1ef 100644
--- a/src/main/java/com/android/tools/r8/GenerateLintFiles.java
+++ b/src/main/java/com/android/tools/r8/GenerateLintFiles.java
@@ -34,8 +34,8 @@
import com.android.tools.r8.graph.LazyLoadedDexApplication;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.jar.CfApplicationWriter;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.origin.Origin;
@@ -73,7 +73,7 @@
private final Reporter reporter = new Reporter();
private final InternalOptions options = new InternalOptions(factory, reporter);
- private final DesugaredLibraryConfiguration desugaredLibraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final Path desugaredLibraryImplementation;
private final Path outputDirectory;
@@ -82,7 +82,7 @@
public GenerateLintFiles(
String desugarConfigurationPath, String desugarImplementationPath, String outputDirectory)
throws Exception {
- this.desugaredLibraryConfiguration =
+ this.desugaredLibrarySpecification =
readDesugaredLibraryConfiguration(desugarConfigurationPath);
this.desugaredLibraryImplementation = Paths.get(desugarImplementationPath);
this.outputDirectory = Paths.get(outputDirectory);
@@ -119,9 +119,9 @@
return Paths.get(jar);
}
- private DesugaredLibraryConfiguration readDesugaredLibraryConfiguration(
+ private LegacyDesugaredLibrarySpecification readDesugaredLibraryConfiguration(
String desugarConfigurationPath) {
- return new DesugaredLibraryConfigurationParser(
+ return new LegacyDesugaredLibrarySpecificationParser(
factory, reporter, false, AndroidApiLevel.B.getLevel())
.parse(StringResource.fromFile(Paths.get(desugarConfigurationPath)));
}
@@ -230,7 +230,7 @@
for (DexProgramClass clazz : dexApplication.classes()) {
String className = clazz.toSourceString();
// All the methods with the rewritten prefix are supported.
- for (String prefix : desugaredLibraryConfiguration.getRewritePrefix().keySet()) {
+ for (String prefix : desugaredLibrarySpecification.getRewritePrefix().keySet()) {
if (clazz.accessFlags.isPublic() && className.startsWith(prefix)) {
DexProgramClass implementationClass =
implementationApplication.programDefinitionFor(clazz.getType());
@@ -259,11 +259,11 @@
// All retargeted methods are supported.
for (DexEncodedMethod method : clazz.methods()) {
- if (desugaredLibraryConfiguration
+ if (desugaredLibrarySpecification
.getRetargetCoreLibMember()
.keySet()
.contains(method.getReference().name)) {
- if (desugaredLibraryConfiguration
+ if (desugaredLibrarySpecification
.getRetargetCoreLibMember()
.get(method.getReference().name)
.containsKey(clazz.type)) {
@@ -275,7 +275,7 @@
}
// All emulated interfaces static and default methods are supported.
- if (desugaredLibraryConfiguration.getEmulateLibraryInterface().containsKey(clazz.type)) {
+ if (desugaredLibrarySpecification.getEmulateLibraryInterface().containsKey(clazz.type)) {
assert clazz.isInterface();
for (DexEncodedMethod method : clazz.methods()) {
if (!method.isDefaultMethod() && !method.isStatic()) {
@@ -384,7 +384,7 @@
private void run() throws Exception {
// Run over all the API levels that the desugared library can be compiled with.
for (int apiLevel = AndroidApiLevel.LATEST.getLevel();
- apiLevel >= desugaredLibraryConfiguration.getRequiredCompilationApiLevel().getLevel();
+ apiLevel >= desugaredLibrarySpecification.getRequiredCompilationApiLevel().getLevel();
apiLevel--) {
System.out.println("Generating lint files for compile API " + apiLevel);
run(apiLevel);
diff --git a/src/main/java/com/android/tools/r8/L8.java b/src/main/java/com/android/tools/r8/L8.java
index 318a055..c68fc77 100644
--- a/src/main/java/com/android/tools/r8/L8.java
+++ b/src/main/java/com/android/tools/r8/L8.java
@@ -162,7 +162,7 @@
new ApplicationReader(inputApp, options, timing).read(executor);
PrefixRewritingMapper rewritePrefix =
- options.desugaredLibraryConfiguration.getPrefixRewritingMapper();
+ options.desugaredLibrarySpecification.getPrefixRewritingMapper();
DexApplication app = new L8TreePruner(options).prune(lazyApp, rewritePrefix);
return AppView.createForL8(AppInfo.createInitialAppInfo(app), rewritePrefix);
diff --git a/src/main/java/com/android/tools/r8/L8Command.java b/src/main/java/com/android/tools/r8/L8Command.java
index 51ea781..c39a041 100644
--- a/src/main/java/com/android/tools/r8/L8Command.java
+++ b/src/main/java/com/android/tools/r8/L8Command.java
@@ -12,7 +12,7 @@
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.horizontalclassmerging.HorizontalClassMerger;
import com.android.tools.r8.inspector.Inspector;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.AndroidApp;
@@ -42,7 +42,7 @@
private final D8Command d8Command;
private final R8Command r8Command;
- private final DesugaredLibraryConfiguration libraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final DexItemFactory factory;
boolean isShrinking() {
@@ -95,7 +95,7 @@
Reporter diagnosticsHandler,
boolean encodeChecksum,
BiPredicate<String, Long> dexClassChecksumFilter,
- DesugaredLibraryConfiguration libraryConfiguration,
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification,
List<AssertionsConfiguration> assertionsConfiguration,
List<Consumer<Inspector>> outputInspections,
int threadCount,
@@ -121,7 +121,7 @@
null);
this.d8Command = d8Command;
this.r8Command = r8Command;
- this.libraryConfiguration = libraryConfiguration;
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.factory = factory;
}
@@ -129,7 +129,7 @@
super(printHelp, printVersion);
r8Command = null;
d8Command = null;
- libraryConfiguration = null;
+ desugaredLibrarySpecification = null;
factory = null;
}
@@ -194,10 +194,10 @@
assert internal.enableInheritanceClassInDexDistributor;
internal.enableInheritanceClassInDexDistributor = false;
- assert libraryConfiguration != null;
- internal.desugaredLibraryConfiguration = libraryConfiguration;
+ assert desugaredLibrarySpecification != null;
+ internal.desugaredLibrarySpecification = desugaredLibrarySpecification;
internal.synthesizedClassPrefix =
- libraryConfiguration.getSynthesizedLibraryClassesPackagePrefix();
+ desugaredLibrarySpecification.getSynthesizedLibraryClassesPackagePrefix();
// Default is to remove all javac generated assertion code when generating dex.
assert internal.assertionsConfiguration == null;
@@ -332,7 +332,7 @@
}
DexItemFactory factory = new DexItemFactory();
- DesugaredLibraryConfiguration libraryConfiguration =
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
getDesugaredLibraryConfiguration(factory, true);
R8Command r8Command = null;
@@ -346,7 +346,7 @@
R8Command.builder(getReporter())
.addProgramResourceProvider((ProgramResourceProvider) l8CfConsumer)
.setSynthesizedClassesPrefix(
- libraryConfiguration.getSynthesizedLibraryClassesPackagePrefix())
+ desugaredLibrarySpecification.getSynthesizedLibraryClassesPackagePrefix())
.setMinApiLevel(getMinApiLevel())
.setMode(getMode())
.setIncludeClassesChecksum(getIncludeClassesChecksum())
@@ -363,7 +363,7 @@
r8Builder.setProguardMapConsumer(proguardMapConsumer);
}
r8Builder.addProguardConfiguration(
- libraryConfiguration.getExtraKeepRules(), Origin.unknown());
+ desugaredLibrarySpecification.getExtraKeepRules(), Origin.unknown());
// TODO(b/180903899): Remove rule when -dontwarn sun.misc.Unsafe is part of config.
r8Builder.addProguardConfiguration(
ImmutableList.of("-dontwarn sun.misc.Unsafe"), Origin.unknown());
@@ -377,7 +377,7 @@
D8Command.builder(getReporter())
.addProgramResourceProvider((ProgramResourceProvider) l8CfConsumer)
.setSynthesizedClassesPrefix(
- libraryConfiguration.getSynthesizedLibraryClassesPackagePrefix())
+ desugaredLibrarySpecification.getSynthesizedLibraryClassesPackagePrefix())
.setMinApiLevel(getMinApiLevel())
.setMode(getMode())
.setIncludeClassesChecksum(getIncludeClassesChecksum())
@@ -406,7 +406,7 @@
getReporter(),
getIncludeClassesChecksum(),
getDexClassChecksumFilter(),
- libraryConfiguration,
+ desugaredLibrarySpecification,
getAssertionsConfiguration(),
getOutputInspections(),
getThreadCount(),
@@ -444,6 +444,6 @@
if (r8Command != null) {
builder.setProguardConfiguration(r8Command.getInternalOptions().getProguardConfiguration());
}
- return builder.setDesugaredLibraryConfiguration(libraryConfiguration).build();
+ return builder.setDesugaredLibraryConfiguration(desugaredLibrarySpecification).build();
}
}
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index cf83f78..b216f04 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -309,7 +309,7 @@
if (!options.mainDexKeepRules.isEmpty()) {
MainDexListBuilder.checkForAssumedLibraryTypes(appView.appInfo());
}
- if (!options.desugaredLibraryConfiguration.getRetargetCoreLibMember().isEmpty()) {
+ if (!options.desugaredLibrarySpecification.getRetargetCoreLibMember().isEmpty()) {
DesugaredLibraryRetargeterLibraryTypeSynthesizer.checkForAssumedLibraryTypes(appView);
DesugaredLibraryRetargeterLibraryTypeSynthesizer.amendLibraryWithRetargetedMembers(appView);
}
diff --git a/src/main/java/com/android/tools/r8/R8Command.java b/src/main/java/com/android/tools/r8/R8Command.java
index 4b53393..b51ee2e 100644
--- a/src/main/java/com/android/tools/r8/R8Command.java
+++ b/src/main/java/com/android/tools/r8/R8Command.java
@@ -15,7 +15,7 @@
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.inspector.Inspector;
import com.android.tools.r8.inspector.internal.InspectorImpl;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.naming.SourceFileRewriter;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.origin.PathOrigin;
@@ -475,7 +475,7 @@
List<ProguardConfigurationRule> mainDexKeepRules =
ProguardConfigurationParser.parse(mainDexRules, factory, reporter);
- DesugaredLibraryConfiguration libraryConfiguration =
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
getDesugaredLibraryConfiguration(factory, false);
ProguardConfigurationParser parser =
@@ -585,7 +585,7 @@
getIncludeClassesChecksum(),
getDexClassChecksumFilter(),
desugaredLibraryKeepRuleConsumer,
- libraryConfiguration,
+ desugaredLibrarySpecification,
featureSplitConfiguration,
getAssertionsConfiguration(),
getOutputInspections(),
@@ -669,7 +669,7 @@
private final GraphConsumer mainDexKeptGraphConsumer;
private final Consumer<List<ProguardConfigurationRule>> syntheticProguardRulesConsumer;
private final StringConsumer desugaredLibraryKeepRuleConsumer;
- private final DesugaredLibraryConfiguration libraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final FeatureSplitConfiguration featureSplitConfiguration;
private final String synthesizedClassPrefix;
private final boolean skipDump;
@@ -747,7 +747,7 @@
boolean encodeChecksum,
BiPredicate<String, Long> dexClassChecksumFilter,
StringConsumer desugaredLibraryKeepRuleConsumer,
- DesugaredLibraryConfiguration libraryConfiguration,
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification,
FeatureSplitConfiguration featureSplitConfiguration,
List<AssertionsConfiguration> assertionsConfiguration,
List<Consumer<Inspector>> outputInspections,
@@ -791,7 +791,7 @@
this.mainDexKeptGraphConsumer = mainDexKeptGraphConsumer;
this.syntheticProguardRulesConsumer = syntheticProguardRulesConsumer;
this.desugaredLibraryKeepRuleConsumer = desugaredLibraryKeepRuleConsumer;
- this.libraryConfiguration = libraryConfiguration;
+ this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.featureSplitConfiguration = featureSplitConfiguration;
this.synthesizedClassPrefix = synthesizedClassPrefix;
this.skipDump = skipDump;
@@ -814,7 +814,7 @@
mainDexKeptGraphConsumer = null;
syntheticProguardRulesConsumer = null;
desugaredLibraryKeepRuleConsumer = null;
- libraryConfiguration = null;
+ desugaredLibrarySpecification = null;
featureSplitConfiguration = null;
synthesizedClassPrefix = null;
skipDump = false;
@@ -942,7 +942,7 @@
internal.enableInheritanceClassInDexDistributor = isOptimizeMultidexForLinearAlloc();
- internal.desugaredLibraryConfiguration = libraryConfiguration;
+ internal.desugaredLibrarySpecification = desugaredLibrarySpecification;
internal.synthesizedClassPrefix = synthesizedClassPrefix;
internal.desugaredLibraryKeepRuleConsumer = desugaredLibraryKeepRuleConsumer;
@@ -1000,7 +1000,7 @@
.setFeatureSplitConfiguration(featureSplitConfiguration)
.setProguardConfiguration(proguardConfiguration)
.setMainDexKeepRules(mainDexKeepRules)
- .setDesugaredLibraryConfiguration(libraryConfiguration)
+ .setDesugaredLibraryConfiguration(desugaredLibrarySpecification)
.build();
}
}
diff --git a/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java b/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
index 27fbc38..b4609ce 100644
--- a/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
+++ b/src/main/java/com/android/tools/r8/androidapi/AndroidApiReferenceLevelCache.java
@@ -9,14 +9,14 @@
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexReference;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.google.common.collect.ImmutableList;
import java.util.List;
public class AndroidApiReferenceLevelCache {
- private final DesugaredLibraryConfiguration desugaredLibraryConfiguration;
+ private final LegacyDesugaredLibrarySpecification desugaredLibrarySpecification;
private final AndroidApiLevelCompute apiLevelCompute;
private final AndroidApiLevelDatabase androidApiLevelDatabase;
private final AppView<?> appView;
@@ -31,7 +31,7 @@
factory = appView.dexItemFactory();
androidApiLevelDatabase =
new AndroidApiLevelHashingDatabaseImpl(predefinedApiTypeLookupForHashing);
- desugaredLibraryConfiguration = appView.options().desugaredLibraryConfiguration;
+ desugaredLibrarySpecification = appView.options().desugaredLibrarySpecification;
}
public static AndroidApiReferenceLevelCache create(
@@ -69,7 +69,7 @@
if (reference.getContextType() == factory.objectType) {
return appView.computedMinApiLevel();
}
- if (desugaredLibraryConfiguration.isSupported(reference, appView)) {
+ if (desugaredLibrarySpecification.isSupported(reference, appView)) {
// If we end up desugaring the reference, the library classes is bridged by j$ which is part
// of the program.
return appView.computedMinApiLevel();
diff --git a/src/main/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryKeepRuleGenerator.java b/src/main/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryKeepRuleGenerator.java
index c7c920b..a720021 100644
--- a/src/main/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryKeepRuleGenerator.java
+++ b/src/main/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryKeepRuleGenerator.java
@@ -13,7 +13,7 @@
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.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.references.ArrayReference;
import com.android.tools.r8.references.ClassReference;
@@ -71,7 +71,7 @@
return false;
}
return namingLens.hasPrefixRewritingLogic()
- || options.desugaredLibraryConfiguration.hasEmulatedLibraryInterfaces();
+ || options.desugaredLibrarySpecification.hasEmulatedLibraryInterfaces();
}
private void run() {
@@ -80,15 +80,15 @@
}
private Predicate<DexType> createTargetPredicate() {
- DesugaredLibraryConfiguration desugaredLibraryConfiguration =
- options.desugaredLibraryConfiguration;
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
+ options.desugaredLibrarySpecification;
Set<DexType> potentialTypesToKeep =
SetUtils.newIdentityHashSet(
- desugaredLibraryConfiguration.getCustomConversions().values(),
- desugaredLibraryConfiguration.getEmulateLibraryInterface().values());
+ desugaredLibrarySpecification.getCustomConversions().values(),
+ desugaredLibrarySpecification.getEmulateLibraryInterface().values());
byte[] synthesizedLibraryClassesPackageDescriptorPrefix =
DexString.encodeToMutf8(
- "L" + desugaredLibraryConfiguration.getSynthesizedLibraryClassesPackagePrefix());
+ "L" + desugaredLibrarySpecification.getSynthesizedLibraryClassesPackagePrefix());
return type ->
namingLens.prefixRewrittenType(type) != null
|| potentialTypesToKeep.contains(type)
diff --git a/src/main/java/com/android/tools/r8/dex/CodeToKeep.java b/src/main/java/com/android/tools/r8/dex/CodeToKeep.java
index 44affb4..cc05c31 100644
--- a/src/main/java/com/android/tools/r8/dex/CodeToKeep.java
+++ b/src/main/java/com/android/tools/r8/dex/CodeToKeep.java
@@ -25,7 +25,7 @@
static CodeToKeep createCodeToKeep(InternalOptions options, NamingLens namingLens) {
if ((!namingLens.hasPrefixRewritingLogic()
- && !options.desugaredLibraryConfiguration.hasEmulatedLibraryInterfaces())
+ && !options.desugaredLibrarySpecification.hasEmulatedLibraryInterfaces())
|| options.isDesugaredLibraryCompilation()
|| options.testing.enableExperimentalDesugaredLibraryKeepRuleGenerator) {
return new NopCodeToKeep();
@@ -65,9 +65,9 @@
this.namingLens = namingLens;
this.options = options;
potentialTypesToKeep.addAll(
- options.desugaredLibraryConfiguration.getEmulateLibraryInterface().values());
+ options.desugaredLibrarySpecification.getEmulateLibraryInterface().values());
potentialTypesToKeep.addAll(
- options.desugaredLibraryConfiguration.getCustomConversions().values());
+ options.desugaredLibrarySpecification.getCustomConversions().values());
}
private boolean shouldKeep(DexType type) {
@@ -77,7 +77,7 @@
|| type.toDescriptorString()
.startsWith(
"L"
- + options.desugaredLibraryConfiguration
+ + options.desugaredLibrarySpecification
.getSynthesizedLibraryClassesPackagePrefix());
}
diff --git a/src/main/java/com/android/tools/r8/graph/AppView.java b/src/main/java/com/android/tools/r8/graph/AppView.java
index 7f4ccf5..c2316e4 100644
--- a/src/main/java/com/android/tools/r8/graph/AppView.java
+++ b/src/main/java/com/android/tools/r8/graph/AppView.java
@@ -160,7 +160,7 @@
private static <T extends AppInfo> PrefixRewritingMapper defaultPrefixRewritingMapper(T appInfo) {
InternalOptions options = appInfo.options();
- return options.desugaredLibraryConfiguration.getPrefixRewritingMapper();
+ return options.desugaredLibrarySpecification.getPrefixRewritingMapper();
}
public static <T extends AppInfo> AppView<T> createForD8(T appInfo) {
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 ed1260e..fba32bb 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
@@ -97,7 +97,7 @@
AndroidApp androidApp, InternalOptions options, ExecutorService executor) throws IOException {
List<DexMethod> methods = new ArrayList<>();
PrefixRewritingMapper rewritePrefix =
- options.desugaredLibraryConfiguration.getPrefixRewritingMapper();
+ options.desugaredLibrarySpecification.getPrefixRewritingMapper();
AppInfo appInfo = null;
if (androidApp != null) {
DexApplication app =
@@ -135,13 +135,13 @@
&& appView.options().isDesugaredLibraryCompilation()
&& appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getBackportCoreLibraryMember()
.containsKey(method.holder)) {
DexType newHolder =
appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getBackportCoreLibraryMember()
.get(method.holder);
DexMethod backportedMethod =
@@ -1366,7 +1366,7 @@
}
private void addProvider(MethodProvider generator) {
- if (appView.options().desugaredLibraryConfiguration.isSupported(generator.method, appView)) {
+ if (appView.options().desugaredLibrarySpecification.isSupported(generator.method, appView)) {
// TODO(b/174453232): Remove this after the configuration file format has bee updated
// with the "rewrite_method" section.
if (generator.method.getHolderType() == appView.dexItemFactory().objectsType) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/CfPostProcessingDesugaringCollection.java b/src/main/java/com/android/tools/r8/ir/desugar/CfPostProcessingDesugaringCollection.java
index 064e82d..09272ea 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/CfPostProcessingDesugaringCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/CfPostProcessingDesugaringCollection.java
@@ -57,7 +57,7 @@
InterfaceMethodProcessorFacade interfaceMethodProcessorFacade,
RetargetingInfo retargetingInfo) {
ArrayList<CfPostProcessingDesugaring> desugarings = new ArrayList<>();
- if (!appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember().isEmpty()
+ if (!appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember().isEmpty()
&& !appView.options().isDesugaredLibraryCompilation()) {
desugarings.add(new DesugaredLibraryRetargeterPostProcessor(appView, retargetingInfo));
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java b/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
index f722159..04b755f 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
@@ -79,7 +79,7 @@
this.nestBasedAccessDesugaring = NestBasedAccessDesugaring.create(appView);
BackportedMethodRewriter backportedMethodRewriter = null;
desugaredLibraryRetargeter =
- appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember().isEmpty()
+ appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember().isEmpty()
? null
: new DesugaredLibraryRetargeter(appView);
if (desugaredLibraryRetargeter != null) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPICallbackSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPICallbackSynthesizer.java
index 92d7b92..e95ae91 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPICallbackSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPICallbackSynthesizer.java
@@ -109,7 +109,7 @@
if (!appView.rewritePrefix.hasRewrittenTypeInSignature(definition.getProto(), appView)
|| appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getEmulateLibraryInterface()
.containsKey(method.getHolderType())) {
return false;
@@ -127,7 +127,7 @@
return false;
}
}
- if (!appView.options().desugaredLibraryConfiguration.supportAllCallbacksFromLibrary
+ if (!appView.options().desugaredLibrarySpecification.supportAllCallbacksFromLibrary
&& appView.options().isDesugaredLibraryCompilation()) {
return false;
}
@@ -178,11 +178,11 @@
}
private boolean shouldGenerateCallbacksForEmulateInterfaceAPIs(DexClass dexClass) {
- if (appView.options().desugaredLibraryConfiguration.supportAllCallbacksFromLibrary) {
+ if (appView.options().desugaredLibrarySpecification.supportAllCallbacksFromLibrary) {
return true;
}
Map<DexType, DexType> emulateLibraryInterfaces =
- appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface();
+ appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface();
return !(emulateLibraryInterfaces.containsKey(dexClass.type)
|| emulateLibraryInterfaces.containsValue(dexClass.type));
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPIConverter.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPIConverter.java
index 460c350..8e20905 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPIConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryAPIConverter.java
@@ -181,7 +181,7 @@
return interfaceResult != null
&& appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getEmulateLibraryInterface()
.containsKey(interfaceResult.getHolderType());
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeter.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeter.java
index 01c504c..c570091 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeter.java
@@ -130,7 +130,7 @@
}
if (appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getDontRetargetLibMember()
.contains(context.getContextType())) {
return NO_REWRITING;
@@ -149,7 +149,7 @@
// Final methods can be rewritten as a normal invoke.
if (superTarget != null && !superTarget.getAccessFlags().isFinal()) {
return InvokeRetargetingResult.createInvokeRetargetingResult(
- appView.options().desugaredLibraryConfiguration.retargetMethod(superTarget, appView));
+ appView.options().desugaredLibrarySpecification.retargetMethod(superTarget, appView));
}
}
return retarget;
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterL8Synthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterL8Synthesizer.java
index 73cbd3d..2ccd9d2 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterL8Synthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterL8Synthesizer.java
@@ -19,7 +19,7 @@
AppView<?> appView, RetargetingInfo retargetingInfo) {
assert appView.options().isDesugaredLibraryCompilation();
if (retargetingInfo == null || retargetingInfo.getEmulatedDispatchMethods().isEmpty()) {
- assert appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember().isEmpty();
+ assert appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember().isEmpty();
return null;
}
return new DesugaredLibraryRetargeterL8Synthesizer(appView, retargetingInfo);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterLibraryTypeSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterLibraryTypeSynthesizer.java
index faa5857..b9c6593 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterLibraryTypeSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterLibraryTypeSynthesizer.java
@@ -40,7 +40,7 @@
public static void checkForAssumedLibraryTypes(AppView<?> appView) {
Map<DexString, Map<DexType, DexType>> retargetCoreLibMember =
- appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember();
+ appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember();
for (DexString methodName : retargetCoreLibMember.keySet()) {
for (DexType inType : retargetCoreLibMember.get(methodName).keySet()) {
DexClass typeClass = appView.definitionFor(inType);
@@ -53,7 +53,7 @@
public static void amendLibraryWithRetargetedMembers(AppView<AppInfoWithClassHierarchy> appView) {
Map<DexString, Map<DexType, DexType>> retargetCoreLibMember =
- appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember();
+ appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember();
Map<DexType, DexLibraryClass> synthesizedLibraryClasses =
synthesizeLibraryClassesForRetargetedMembers(appView, retargetCoreLibMember);
Map<DexLibraryClass, Set<DexEncodedMethod>> synthesizedLibraryMethods =
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterPostProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterPostProcessor.java
index 1a2adfb..74aa92a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterPostProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterPostProcessor.java
@@ -123,7 +123,7 @@
}
if (appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getDontRetargetLibMember()
.contains(clazz.getType())) {
continue;
@@ -144,7 +144,7 @@
// even if this results in invalid code, these classes are never desugared.
// In desugared library, emulated interface methods can be overridden by retarget lib members.
DexMethod forwardMethod =
- appView.options().desugaredLibraryConfiguration.retargetMethod(target, appView);
+ appView.options().desugaredLibrarySpecification.retargetMethod(target, appView);
assert forwardMethod != null && forwardMethod != target.getReference();
DexEncodedMethod desugaringForwardingMethod =
DexEncodedMethod.createDesugaringForwardingMethod(
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterSyntheticHelper.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterSyntheticHelper.java
index 5dde56e..34bbcc2 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterSyntheticHelper.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryRetargeterSyntheticHelper.java
@@ -151,7 +151,7 @@
DexMethod desugarMethod =
appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.retargetMethod(emulatedDispatchMethod, appView);
assert desugarMethod
!= null; // This method is reached only for retarget core lib members.
@@ -178,7 +178,7 @@
private void rewriteType(DexType type) {
String newName =
- appView.options().desugaredLibraryConfiguration.convertJavaNameToDesugaredLibrary(type);
+ appView.options().desugaredLibrarySpecification.convertJavaNameToDesugaredLibrary(type);
DexType newType =
appView.dexItemFactory().createType(DescriptorUtils.javaTypeToDescriptor(newName));
appView.rewritePrefix.rewriteType(type, newType);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryWrapperSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryWrapperSynthesizer.java
index 14240a6..a885766 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryWrapperSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryWrapperSynthesizer.java
@@ -27,6 +27,7 @@
import com.android.tools.r8.ir.desugar.CfClassSynthesizerDesugaringEventConsumer;
import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryWrapperSynthesizerEventConsumer.DesugaredLibraryClasspathWrapperSynthesizeEventConsumer;
import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryWrapperSynthesizerEventConsumer.DesugaredLibraryL8ProgramWrapperSynthesizerEventConsumer;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.ir.synthetic.DesugaredLibraryAPIConversionCfCodeProvider.APIConverterConstructorCfCodeProvider;
import com.android.tools.r8.ir.synthetic.DesugaredLibraryAPIConversionCfCodeProvider.APIConverterThrowRuntimeExceptionCfCodeProvider;
import com.android.tools.r8.ir.synthetic.DesugaredLibraryAPIConversionCfCodeProvider.APIConverterVivifiedWrapperCfCodeProvider;
@@ -178,7 +179,7 @@
// ConversionType holds the methods "rewrittenType convert(type)" and the other way around.
// But everything is going to be rewritten, so we need to use vivifiedType and type".
DexType conversionHolder =
- appView.options().desugaredLibraryConfiguration.getCustomConversions().get(type);
+ appView.options().desugaredLibrarySpecification.getCustomConversions().get(type);
if (conversionHolder != null) {
return factory.createMethod(
conversionHolder, factory.createProto(destType, srcType), factory.convertMethodName);
@@ -187,7 +188,7 @@
}
private boolean canConvert(DexType type) {
- return appView.options().desugaredLibraryConfiguration.getCustomConversions().containsKey(type)
+ return appView.options().desugaredLibrarySpecification.getCustomConversions().containsKey(type)
|| canGenerateWrapper(type);
}
@@ -215,7 +216,7 @@
}
private boolean canGenerateWrapper(DexType type) {
- return appView.options().desugaredLibraryConfiguration.getWrapperConversions().contains(type);
+ return appView.options().desugaredLibrarySpecification.getWrapperConversions().contains(type);
}
private DexClass getValidClassToWrap(DexType type) {
@@ -476,7 +477,7 @@
if (holderClass == null) {
assert appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getEmulateLibraryInterface()
.containsValue(dexEncodedMethod.getHolderType());
isInterface = true;
@@ -666,10 +667,10 @@
// conversion methods are present.
@Override
public void synthesizeClasses(CfClassSynthesizerDesugaringEventConsumer eventConsumer) {
- DesugaredLibraryConfiguration conf = appView.options().desugaredLibraryConfiguration;
+ LegacyDesugaredLibrarySpecification spec = appView.options().desugaredLibrarySpecification;
List<DexProgramClass> validClassesToWrap = new ArrayList<>();
- for (DexType type : conf.getWrapperConversions()) {
- assert !conf.getCustomConversions().containsKey(type);
+ for (DexType type : spec.getWrapperConversions()) {
+ assert !spec.getCustomConversions().containsKey(type);
DexClass validClassToWrap = getValidClassToWrap(type);
// In broken set-ups we can end up having a json files containing wrappers of non desugared
// classes. Such wrappers are not required since the class won't be rewritten.
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/RetargetingInfo.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/RetargetingInfo.java
index 525801f..5e5fc52 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/RetargetingInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/RetargetingInfo.java
@@ -11,6 +11,7 @@
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.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.utils.WorkList;
import com.android.tools.r8.utils.collections.DexClassAndMethodSet;
import com.google.common.collect.ImmutableMap;
@@ -66,10 +67,10 @@
}
private RetargetingInfo computeRetargetingInfo() {
- DesugaredLibraryConfiguration desugaredLibraryConfiguration =
- appView.options().desugaredLibraryConfiguration;
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
+ appView.options().desugaredLibrarySpecification;
Map<DexString, Map<DexType, DexType>> retargetCoreLibMember =
- desugaredLibraryConfiguration.getRetargetCoreLibMember();
+ desugaredLibrarySpecification.getRetargetCoreLibMember();
if (retargetCoreLibMember.isEmpty()) {
return new RetargetingInfo(
ImmutableMap.of(), ImmutableMap.of(), DexClassAndMethodSet.empty());
@@ -108,7 +109,7 @@
}
}
}
- if (desugaredLibraryConfiguration.isLibraryCompilation()) {
+ if (desugaredLibrarySpecification.isLibraryCompilation()) {
// TODO(b/177977763): This is only a workaround rewriting invokes of j.u.Arrays.deepEquals0
// to j.u.DesugarArrays.deepEquals0.
DexItemFactory itemFactory = appView.options().dexItemFactory();
@@ -152,7 +153,7 @@
private boolean isEmulatedInterfaceDispatch(DexClassAndMethod method) {
// Answers true if this method is already managed through emulated interface dispatch.
Map<DexType, DexType> emulateLibraryInterface =
- appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface();
+ appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface();
if (emulateLibraryInterface.isEmpty()) {
return false;
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfiguration.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecification.java
similarity index 94%
rename from src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfiguration.java
rename to src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecification.java
index 326b3c9..87ac465 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfiguration.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecification.java
@@ -1,7 +1,7 @@
// Copyright (c) 2021, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.ir.desugar.desugaredlibrary;
+package com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification;
import com.android.tools.r8.errors.CompilationError;
import com.android.tools.r8.graph.AppView;
@@ -35,7 +35,7 @@
import java.util.Set;
import java.util.stream.Collectors;
-public class DesugaredLibraryConfiguration {
+public class LegacyDesugaredLibrarySpecification {
public static final String FALL_BACK_SYNTHESIZED_CLASSES_PACKAGE_PREFIX = "j$/";
public static final boolean FALL_BACK_SUPPORT_ALL_CALLBACKS_FROM_LIBRARY = true;
private final AndroidApiLevel requiredCompilationAPILevel;
@@ -66,9 +66,9 @@
return new Builder(dexItemFactory, reporter, origin);
}
- public static DesugaredLibraryConfiguration withOnlyRewritePrefixForTesting(
+ public static LegacyDesugaredLibrarySpecification withOnlyRewritePrefixForTesting(
Map<String, String> prefix, InternalOptions options) {
- return new DesugaredLibraryConfiguration(
+ return new LegacyDesugaredLibrarySpecification(
AndroidApiLevel.B,
true,
FALL_BACK_SYNTHESIZED_CLASSES_PACKAGE_PREFIX,
@@ -87,8 +87,8 @@
new DesugarPrefixRewritingMapper(prefix, options.itemFactory, true));
}
- public static DesugaredLibraryConfiguration empty() {
- return new DesugaredLibraryConfiguration(
+ public static LegacyDesugaredLibrarySpecification empty() {
+ return new LegacyDesugaredLibrarySpecification(
AndroidApiLevel.B,
false,
FALL_BACK_SYNTHESIZED_CLASSES_PACKAGE_PREFIX,
@@ -118,7 +118,7 @@
};
}
- private DesugaredLibraryConfiguration(
+ private LegacyDesugaredLibrarySpecification(
AndroidApiLevel requiredCompilationAPILevel,
boolean libraryCompilation,
String packagePrefix,
@@ -337,7 +337,7 @@
rewritePrefix,
prefix,
rewrittenPrefix,
- DesugaredLibraryConfigurationParser.REWRITE_PREFIX_KEY);
+ LegacyDesugaredLibrarySpecificationParser.REWRITE_PREFIX_KEY);
return this;
}
@@ -349,7 +349,7 @@
emulateLibraryInterface,
interfaceType,
rewrittenType,
- DesugaredLibraryConfigurationParser.EMULATE_INTERFACE_KEY);
+ LegacyDesugaredLibrarySpecificationParser.EMULATE_INTERFACE_KEY);
return this;
}
@@ -360,7 +360,7 @@
customConversions,
dexType,
conversionType,
- DesugaredLibraryConfigurationParser.CUSTOM_CONVERSION_KEY);
+ LegacyDesugaredLibrarySpecificationParser.CUSTOM_CONVERSION_KEY);
return this;
}
@@ -382,7 +382,7 @@
typeMap,
originalType,
finalType,
- DesugaredLibraryConfigurationParser.RETARGET_LIB_MEMBER_KEY);
+ LegacyDesugaredLibrarySpecificationParser.RETARGET_LIB_MEMBER_KEY);
return this;
}
@@ -393,7 +393,7 @@
backportCoreLibraryMember,
backportType,
rewrittenBackportType,
- DesugaredLibraryConfigurationParser.BACKPORT_KEY);
+ LegacyDesugaredLibrarySpecificationParser.BACKPORT_KEY);
return this;
}
@@ -428,9 +428,9 @@
this.supportAllCallbacksFromLibrary = supportAllCallbacksFromLibrary;
}
- public DesugaredLibraryConfiguration build() {
+ public LegacyDesugaredLibrarySpecification build() {
validate();
- return new DesugaredLibraryConfiguration(
+ return new LegacyDesugaredLibrarySpecification(
requiredCompilationAPILevel,
libraryCompilation,
synthesizedLibraryClassesPackagePrefix,
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfigurationParser.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecificationParser.java
similarity index 82%
rename from src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfigurationParser.java
rename to src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecificationParser.java
index f8b69f6..ba53f55 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/DesugaredLibraryConfigurationParser.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/legacyspecification/LegacyDesugaredLibrarySpecificationParser.java
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.ir.desugar.desugaredlibrary;
+package com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification;
import com.android.tools.r8.StringResource;
import com.android.tools.r8.graph.DexItemFactory;
@@ -21,7 +21,7 @@
import java.util.Map;
import java.util.function.Consumer;
-public class DesugaredLibraryConfigurationParser {
+public class LegacyDesugaredLibrarySpecificationParser {
public static final int MAX_SUPPORTED_VERSION = 4;
public static final SemanticVersion MIN_SUPPORTED_VERSION = new SemanticVersion(1, 0, 9);
@@ -55,10 +55,10 @@
private final boolean libraryCompilation;
private final int minAPILevel;
- private DesugaredLibraryConfiguration.Builder configurationBuilder = null;
+ private LegacyDesugaredLibrarySpecification.Builder specificationBuilder = null;
private Origin origin;
- public DesugaredLibraryConfigurationParser(
+ public LegacyDesugaredLibrarySpecificationParser(
DexItemFactory dexItemFactory,
Reporter reporter,
boolean libraryCompilation,
@@ -79,20 +79,21 @@
return json.get(key);
}
- public DesugaredLibraryConfiguration parse(StringResource stringResource) {
+ public LegacyDesugaredLibrarySpecification parse(StringResource stringResource) {
return parse(stringResource, builder -> {});
}
- public DesugaredLibraryConfiguration parse(
+ public LegacyDesugaredLibrarySpecification parse(
StringResource stringResource,
- Consumer<DesugaredLibraryConfiguration.Builder> configurationAmender) {
+ Consumer<LegacyDesugaredLibrarySpecification.Builder> configurationAmender) {
origin = stringResource.getOrigin();
assert origin != null;
- configurationBuilder = DesugaredLibraryConfiguration.builder(dexItemFactory, reporter, origin);
+ specificationBuilder =
+ LegacyDesugaredLibrarySpecification.builder(dexItemFactory, reporter, origin);
if (libraryCompilation) {
- configurationBuilder.setLibraryCompilation();
+ specificationBuilder.setLibraryCompilation();
} else {
- configurationBuilder.setProgramCompilation();
+ specificationBuilder.setProgramCompilation();
}
String jsonConfigString;
JsonObject jsonConfig;
@@ -104,7 +105,7 @@
throw reporter.fatalError(new ExceptionDiagnostic(e, origin));
}
- configurationBuilder.setJsonSource(jsonConfigString);
+ specificationBuilder.setJsonSource(jsonConfigString);
JsonElement formatVersionElement = required(jsonConfig, CONFIGURATION_FORMAT_VERSION_KEY);
int formatVersion = formatVersionElement.getAsInt();
@@ -132,13 +133,13 @@
String groupID = required(jsonConfig, GROUP_ID_KEY).getAsString();
String artifactID = required(jsonConfig, ARTIFACT_ID_KEY).getAsString();
String identifier = String.join(":", groupID, artifactID, version);
- configurationBuilder.setDesugaredLibraryIdentifier(identifier);
- configurationBuilder.setSynthesizedLibraryClassesPackagePrefix(
+ specificationBuilder.setDesugaredLibraryIdentifier(identifier);
+ specificationBuilder.setSynthesizedLibraryClassesPackagePrefix(
required(jsonConfig, SYNTHESIZED_LIBRARY_CLASSES_PACKAGE_PREFIX_KEY).getAsString());
int required_compilation_api_level =
required(jsonConfig, REQUIRED_COMPILATION_API_LEVEL_KEY).getAsInt();
- configurationBuilder.setRequiredCompilationAPILevel(
+ specificationBuilder.setRequiredCompilationAPILevel(
AndroidApiLevel.getAndroidApiLevel(required_compilation_api_level));
JsonElement commonFlags = required(jsonConfig, COMMON_FLAGS_KEY);
JsonElement libraryFlags = required(jsonConfig, LIBRARY_FLAGS_KEY);
@@ -152,17 +153,17 @@
for (JsonElement keepRule : jsonKeepRules) {
extraKeepRules.add(keepRule.getAsString());
}
- configurationBuilder.setExtraKeepRules(extraKeepRules);
+ specificationBuilder.setExtraKeepRules(extraKeepRules);
}
if (jsonConfig.has(SUPPORT_ALL_CALLBACKS_FROM_LIBRARY_KEY)) {
boolean supportAllCallbacksFromLibrary =
jsonConfig.get(SUPPORT_ALL_CALLBACKS_FROM_LIBRARY_KEY).getAsBoolean();
- configurationBuilder.setSupportAllCallbacksFromLibrary(supportAllCallbacksFromLibrary);
+ specificationBuilder.setSupportAllCallbacksFromLibrary(supportAllCallbacksFromLibrary);
}
- configurationAmender.accept(configurationBuilder);
- DesugaredLibraryConfiguration config = configurationBuilder.build();
- configurationBuilder = null;
+ configurationAmender.accept(specificationBuilder);
+ LegacyDesugaredLibrarySpecification config = specificationBuilder.build();
+ specificationBuilder = null;
origin = null;
return config;
}
@@ -181,52 +182,52 @@
if (jsonFlagSet.has(REWRITE_PREFIX_KEY)) {
for (Map.Entry<String, JsonElement> rewritePrefix :
jsonFlagSet.get(REWRITE_PREFIX_KEY).getAsJsonObject().entrySet()) {
- configurationBuilder.putRewritePrefix(
+ specificationBuilder.putRewritePrefix(
rewritePrefix.getKey(), rewritePrefix.getValue().getAsString());
}
}
if (jsonFlagSet.has(RETARGET_LIB_MEMBER_KEY)) {
for (Map.Entry<String, JsonElement> retarget :
jsonFlagSet.get(RETARGET_LIB_MEMBER_KEY).getAsJsonObject().entrySet()) {
- configurationBuilder.putRetargetCoreLibMember(
+ specificationBuilder.putRetargetCoreLibMember(
retarget.getKey(), retarget.getValue().getAsString());
}
}
if (jsonFlagSet.has(BACKPORT_KEY)) {
for (Map.Entry<String, JsonElement> backport :
jsonFlagSet.get(BACKPORT_KEY).getAsJsonObject().entrySet()) {
- configurationBuilder.putBackportCoreLibraryMember(
+ specificationBuilder.putBackportCoreLibraryMember(
backport.getKey(), backport.getValue().getAsString());
}
}
if (jsonFlagSet.has(EMULATE_INTERFACE_KEY)) {
for (Map.Entry<String, JsonElement> itf :
jsonFlagSet.get(EMULATE_INTERFACE_KEY).getAsJsonObject().entrySet()) {
- configurationBuilder.putEmulateLibraryInterface(itf.getKey(), itf.getValue().getAsString());
+ specificationBuilder.putEmulateLibraryInterface(itf.getKey(), itf.getValue().getAsString());
}
}
if (jsonFlagSet.has(CUSTOM_CONVERSION_KEY)) {
for (Map.Entry<String, JsonElement> conversion :
jsonFlagSet.get(CUSTOM_CONVERSION_KEY).getAsJsonObject().entrySet()) {
- configurationBuilder.putCustomConversion(
+ specificationBuilder.putCustomConversion(
conversion.getKey(), conversion.getValue().getAsString());
}
}
if (jsonFlagSet.has(WRAPPER_CONVERSION_KEY)) {
for (JsonElement wrapper : jsonFlagSet.get(WRAPPER_CONVERSION_KEY).getAsJsonArray()) {
- configurationBuilder.addWrapperConversion(wrapper.getAsString());
+ specificationBuilder.addWrapperConversion(wrapper.getAsString());
}
}
if (jsonFlagSet.has(DONT_REWRITE_KEY)) {
JsonArray dontRewrite = jsonFlagSet.get(DONT_REWRITE_KEY).getAsJsonArray();
for (JsonElement rewrite : dontRewrite) {
- configurationBuilder.addDontRewriteInvocation(rewrite.getAsString());
+ specificationBuilder.addDontRewriteInvocation(rewrite.getAsString());
}
}
if (jsonFlagSet.has(DONT_RETARGET_LIB_MEMBER_KEY)) {
JsonArray dontRetarget = jsonFlagSet.get(DONT_RETARGET_LIB_MEMBER_KEY).getAsJsonArray();
for (JsonElement rewrite : dontRetarget) {
- configurationBuilder.addDontRetargetLibMember(rewrite.getAsString());
+ specificationBuilder.addDontRetargetLibMember(rewrite.getAsString());
}
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
index 36519f8..0d79ac1 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
@@ -376,10 +376,10 @@
this.dexItemFactory = appView.dexItemFactory();
this.helper = new InterfaceDesugaringSyntheticHelper(appView);
needsLibraryInfo =
- !appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface().isEmpty()
+ !appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface().isEmpty()
|| !appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getRetargetCoreLibMember()
.isEmpty();
this.isLiveMethod = isLiveMethod;
@@ -510,7 +510,7 @@
DexClass iface = appView.definitionFor(emulatedInterface);
if (iface != null) {
assert iface.isLibraryClass()
- || appView.options().desugaredLibraryConfiguration.isLibraryCompilation();
+ || appView.options().desugaredLibrarySpecification.isLibraryCompilation();
workList.addIfNotSeen(iface.getInterfaces());
}
}
@@ -761,7 +761,7 @@
assert needsLibraryInfo();
assert method.getDefinition().isNonPrivateVirtualMethod();
return !method.getAccessFlags().isFinal()
- && appView.options().desugaredLibraryConfiguration.retargetMethod(method, appView) != null;
+ && appView.options().desugaredLibrarySpecification.retargetMethod(method, appView) != null;
}
private boolean dontRewrite(DexClassAndMethod method) {
@@ -850,7 +850,7 @@
DexMethod forwardMethod =
target.getHolder().isInterface()
? helper.ensureDefaultAsMethodOfCompanionClassStub(target).getReference()
- : appView.options().desugaredLibraryConfiguration.retargetMethod(target, appView);
+ : appView.options().desugaredLibrarySpecification.retargetMethod(target, appView);
DexEncodedMethod desugaringForwardingMethod =
DexEncodedMethod.createDesugaringForwardingMethod(
target, clazz, forwardMethod, dexItemFactory);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/EmulatedInterfaceApplicationRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/EmulatedInterfaceApplicationRewriter.java
index af7fb9f..74d94e3 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/EmulatedInterfaceApplicationRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/EmulatedInterfaceApplicationRewriter.java
@@ -26,7 +26,7 @@
public EmulatedInterfaceApplicationRewriter(AppView<?> appView) {
this.appView = appView;
this.emulatedInterfaces =
- appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface();
+ appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface();
}
public void rewriteApplication(DexApplication.Builder<?> builder) {
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 0dc7375..a4800c3 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
@@ -69,7 +69,7 @@
public InterfaceDesugaringSyntheticHelper(AppView<?> appView) {
this.appView = appView;
emulatedInterfaces =
- appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface();
+ appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface();
this.shouldIgnoreFromReportsPredicate = getShouldIgnoreFromReportsPredicate(appView);
}
@@ -100,7 +100,7 @@
boolean dontRewrite(DexClassAndMethod method) {
for (Pair<DexType, DexString> dontRewrite :
- appView.options().desugaredLibraryConfiguration.getDontRewriteInvocation()) {
+ appView.options().desugaredLibrarySpecification.getDontRewriteInvocation()) {
if (method.getHolderType() == dontRewrite.getFirst()
&& method.getName() == dontRewrite.getSecond()) {
return true;
@@ -515,7 +515,7 @@
return appView.rewritePrefix.hasRewrittenType(type, appView)
|| descriptor.endsWith(companionClassNameDescriptorSuffix)
|| isRewrittenEmulatedInterface(type)
- || options.desugaredLibraryConfiguration.getCustomConversions().containsValue(type)
+ || options.desugaredLibrarySpecification.getCustomConversions().containsValue(type)
|| appView.getDontWarnConfiguration().matches(type);
};
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodRewriter.java
index 2152ef0..a40d69a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodRewriter.java
@@ -35,7 +35,7 @@
import com.android.tools.r8.ir.desugar.DesugarDescription;
import com.android.tools.r8.ir.desugar.FreshLocalProvider;
import com.android.tools.r8.ir.desugar.LocalStackAllocator;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.ir.desugar.icce.AlwaysThrowingInstructionDesugaring;
import com.android.tools.r8.ir.desugar.lambda.LambdaInstructionDesugaring;
import com.android.tools.r8.ir.desugar.stringconcat.StringConcatInstructionDesugaring;
@@ -120,11 +120,11 @@
}
public static void checkForAssumedLibraryTypes(AppInfo appInfo, InternalOptions options) {
- DesugaredLibraryConfiguration config = options.desugaredLibraryConfiguration;
+ LegacyDesugaredLibrarySpecification spec = options.desugaredLibrarySpecification;
BiConsumer<DexType, DexType> registerEntry = registerMapEntry(appInfo);
- config.getEmulateLibraryInterface().forEach(registerEntry);
- config.getCustomConversions().forEach(registerEntry);
- config.getRetargetCoreLibMember().forEach((method, types) -> types.forEach(registerEntry));
+ spec.getEmulateLibraryInterface().forEach(registerEntry);
+ spec.getCustomConversions().forEach(registerEntry);
+ spec.getRetargetCoreLibMember().forEach((method, types) -> types.forEach(registerEntry));
}
private static BiConsumer<DexType, DexType> registerMapEntry(AppInfo appInfo) {
@@ -158,7 +158,7 @@
private void initializeEmulatedInterfaceVariables() {
Map<DexType, DexType> emulateLibraryInterface =
- options.desugaredLibraryConfiguration.getEmulateLibraryInterface();
+ options.desugaredLibrarySpecification.getEmulateLibraryInterface();
for (DexType interfaceType : emulateLibraryInterface.keySet()) {
addRewriteRulesForEmulatedInterface(
interfaceType, emulateLibraryInterface.get(interfaceType).toSourceString());
@@ -776,7 +776,7 @@
// method (method is on desugared library). Find out if it needs to be
// retargeted or if it just calls a companion class method and rewrite.
DexMethod retargetMethod =
- options.desugaredLibraryConfiguration.retargetMethod(superTarget, appView);
+ options.desugaredLibrarySpecification.retargetMethod(superTarget, appView);
if (retargetMethod != null) {
return DesugarDescription.builder()
.setDesugarRewrite(
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/ProgramEmulatedInterfaceSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/ProgramEmulatedInterfaceSynthesizer.java
index d68dec8..5c2ec42 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/ProgramEmulatedInterfaceSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/ProgramEmulatedInterfaceSynthesizer.java
@@ -41,7 +41,7 @@
public static ProgramEmulatedInterfaceSynthesizer create(AppView<?> appView) {
if (!appView.options().isDesugaredLibraryCompilation()
- || appView.options().desugaredLibraryConfiguration.getEmulateLibraryInterface().isEmpty()) {
+ || appView.options().desugaredLibrarySpecification.getEmulateLibraryInterface().isEmpty()) {
return null;
}
return new ProgramEmulatedInterfaceSynthesizer(appView);
@@ -166,7 +166,7 @@
// In practice, there is usually a single case (except for tests),
// so we do not bother to make the following loop more clever.
Map<DexString, Map<DexType, DexType>> retargetCoreLibMember =
- appView.options().desugaredLibraryConfiguration.getRetargetCoreLibMember();
+ appView.options().desugaredLibrarySpecification.getRetargetCoreLibMember();
for (DexString methodName : retargetCoreLibMember.keySet()) {
if (method.getName() == methodName) {
for (DexType inType : retargetCoreLibMember.get(methodName).keySet()) {
diff --git a/src/main/java/com/android/tools/r8/shaking/L8TreePruner.java b/src/main/java/com/android/tools/r8/shaking/L8TreePruner.java
index c42b3e0..960ccd5 100644
--- a/src/main/java/com/android/tools/r8/shaking/L8TreePruner.java
+++ b/src/main/java/com/android/tools/r8/shaking/L8TreePruner.java
@@ -28,9 +28,9 @@
public L8TreePruner(InternalOptions options) {
this.options = options;
- backports.addAll(options.desugaredLibraryConfiguration.getBackportCoreLibraryMember().keySet());
+ backports.addAll(options.desugaredLibrarySpecification.getBackportCoreLibraryMember().keySet());
emulatedInterfaces.addAll(
- options.desugaredLibraryConfiguration.getEmulateLibraryInterface().keySet());
+ options.desugaredLibrarySpecification.getEmulateLibraryInterface().keySet());
}
public DexApplication prune(DexApplication app, PrefixRewritingMapper rewritePrefix) {
diff --git a/src/main/java/com/android/tools/r8/synthesis/SynthesizingContext.java b/src/main/java/com/android/tools/r8/synthesis/SynthesizingContext.java
index 9fe1fb9..bbf4258 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SynthesizingContext.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SynthesizingContext.java
@@ -132,7 +132,7 @@
DexType rewrittenContext =
appView
.options()
- .desugaredLibraryConfiguration
+ .desugaredLibrarySpecification
.getEmulateLibraryInterface()
.get(synthesizingContextType);
if (rewrittenContext == null) {
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index dbeefb7..b67a8c2 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -53,7 +53,7 @@
import com.android.tools.r8.horizontalclassmerging.Policy;
import com.android.tools.r8.inspector.internal.InspectorImpl;
import com.android.tools.r8.ir.code.IRCode;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.ir.desugar.nest.Nest;
import com.android.tools.r8.ir.optimize.Inliner;
import com.android.tools.r8.ir.optimize.enums.EnumDataMap;
@@ -385,8 +385,8 @@
if (isGeneratingDex() || desugarState == DesugarState.ON) {
marker.setMinApi(getMinApiLevel().getLevel());
}
- if (desugaredLibraryConfiguration.getIdentifier() != null) {
- marker.setDesugaredLibraryIdentifiers(desugaredLibraryConfiguration.getIdentifier());
+ if (desugaredLibrarySpecification.getIdentifier() != null) {
+ marker.setDesugaredLibraryIdentifiers(desugaredLibrarySpecification.getIdentifier());
}
if (Version.isDevelopmentVersion()) {
marker.setSha1(VersionProperties.INSTANCE.getSha());
@@ -433,7 +433,7 @@
}
public boolean isDesugaredLibraryCompilation() {
- return desugaredLibraryConfiguration.isLibraryCompilation();
+ return desugaredLibrarySpecification.isLibraryCompilation();
}
public boolean isRelocatorCompilation() {
@@ -879,8 +879,8 @@
// If null, no desugaring of library is performed.
// If non null it contains flags describing library desugaring.
- public DesugaredLibraryConfiguration desugaredLibraryConfiguration =
- DesugaredLibraryConfiguration.empty();
+ public LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
+ LegacyDesugaredLibrarySpecification.empty();
public boolean relocatorCompilation = false;
diff --git a/src/test/java/com/android/tools/r8/D8CommandTest.java b/src/test/java/com/android/tools/r8/D8CommandTest.java
index cd1ee66..9740064 100644
--- a/src/test/java/com/android/tools/r8/D8CommandTest.java
+++ b/src/test/java/com/android/tools/r8/D8CommandTest.java
@@ -634,7 +634,7 @@
public void desugaredLibrary() throws CompilationFailedException {
D8Command d8Command = parse("--desugared-lib", "src/library_desugar/desugar_jdk_libs.json");
assertFalse(
- d8Command.getInternalOptions().desugaredLibraryConfiguration.getRewritePrefix().isEmpty());
+ d8Command.getInternalOptions().desugaredLibrarySpecification.getRewritePrefix().isEmpty());
}
@Test
diff --git a/src/test/java/com/android/tools/r8/D8TestBuilder.java b/src/test/java/com/android/tools/r8/D8TestBuilder.java
index b2bf2e8..1c74df5 100644
--- a/src/test/java/com/android/tools/r8/D8TestBuilder.java
+++ b/src/test/java/com/android/tools/r8/D8TestBuilder.java
@@ -90,8 +90,8 @@
public D8TestBuilder enableCoreLibraryDesugaring(
AndroidApiLevel minApiLevel,
KeepRuleConsumer keepRuleConsumer,
- StringResource desugaredLibraryConfiguration) {
- super.enableCoreLibraryDesugaring(minApiLevel, keepRuleConsumer, desugaredLibraryConfiguration);
+ StringResource desugaredLibrarySpecification) {
+ super.enableCoreLibraryDesugaring(minApiLevel, keepRuleConsumer, desugaredLibrarySpecification);
return self();
}
diff --git a/src/test/java/com/android/tools/r8/L8CommandTest.java b/src/test/java/com/android/tools/r8/L8CommandTest.java
index eb44743..e1902f4 100644
--- a/src/test/java/com/android/tools/r8/L8CommandTest.java
+++ b/src/test/java/com/android/tools/r8/L8CommandTest.java
@@ -246,7 +246,7 @@
}
@Test(expected = CompilationFailedException.class)
- public void desugaredLibraryConfigurationRequired() throws Throwable {
+ public void desugaredLibrarySpecificationRequired() throws Throwable {
DiagnosticsChecker.checkErrorsContains(
"L8 requires a desugared library configuration",
(handler) ->
@@ -357,7 +357,7 @@
L8Command l8Command =
parse("--desugared-lib", ToolHelper.getDesugarLibJsonForTesting().toString());
assertFalse(
- l8Command.getInternalOptions().desugaredLibraryConfiguration.getRewritePrefix().isEmpty());
+ l8Command.getInternalOptions().desugaredLibrarySpecification.getRewritePrefix().isEmpty());
}
private void checkSingleForceAllAssertion(
diff --git a/src/test/java/com/android/tools/r8/L8TestBuilder.java b/src/test/java/com/android/tools/r8/L8TestBuilder.java
index e672f87..f2b9a34 100644
--- a/src/test/java/com/android/tools/r8/L8TestBuilder.java
+++ b/src/test/java/com/android/tools/r8/L8TestBuilder.java
@@ -40,7 +40,7 @@
private Consumer<InternalOptions> optionsModifier = ConsumerUtils.emptyConsumer();
private Path desugarJDKLibs = ToolHelper.getDesugarJDKLibs();
private Path desugarJDKLibsConfiguration = null;
- private StringResource desugaredLibraryConfiguration =
+ private StringResource desugaredLibrarySpecification =
StringResource.fromFile(ToolHelper.getDesugarLibJsonForTesting());
private List<Path> libraryFiles = new ArrayList<>();
@@ -130,12 +130,12 @@
}
public L8TestBuilder setDesugaredLibraryConfiguration(Path path) {
- this.desugaredLibraryConfiguration = StringResource.fromFile(path);
+ this.desugaredLibrarySpecification = StringResource.fromFile(path);
return this;
}
public L8TestBuilder setDesugaredLibraryConfiguration(StringResource configuration) {
- this.desugaredLibraryConfiguration = configuration;
+ this.desugaredLibrarySpecification = configuration;
return this;
}
@@ -148,7 +148,7 @@
.addProgramFiles(getProgramFiles())
.addLibraryFiles(getLibraryFiles())
.setMode(mode)
- .addDesugaredLibraryConfiguration(desugaredLibraryConfiguration)
+ .addDesugaredLibraryConfiguration(desugaredLibrarySpecification)
.setMinApiLevel(apiLevel.getLevel())
.setProgramConsumer(
backend.isCf()
diff --git a/src/test/java/com/android/tools/r8/LibraryDesugaringTestConfiguration.java b/src/test/java/com/android/tools/r8/LibraryDesugaringTestConfiguration.java
index d79f4af..0758bf7 100644
--- a/src/test/java/com/android/tools/r8/LibraryDesugaringTestConfiguration.java
+++ b/src/test/java/com/android/tools/r8/LibraryDesugaringTestConfiguration.java
@@ -66,7 +66,7 @@
private final AndroidApiLevel minApiLevel;
private final Path desugarJdkLibs;
private final Path customConversions;
- private final List<StringResource> desugaredLibraryConfigurationResources;
+ private final List<StringResource> desugaredLibrarySpecificationResources;
private final boolean withKeepRuleConsumer;
private final KeepRuleConsumer keepRuleConsumer;
private final CompilationMode mode;
@@ -81,7 +81,7 @@
this.customConversions = null;
this.keepRuleConsumer = null;
this.withKeepRuleConsumer = false;
- this.desugaredLibraryConfigurationResources = null;
+ this.desugaredLibrarySpecificationResources = null;
this.mode = null;
this.addRunClassPath = false;
}
@@ -90,7 +90,7 @@
AndroidApiLevel minApiLevel,
Path desugarJdkLibs,
Path customConversions,
- List<StringResource> desugaredLibraryConfigurationResources,
+ List<StringResource> desugaredLibrarySpecificationResources,
boolean withKeepRuleConsumer,
KeepRuleConsumer keepRuleConsumer,
CompilationMode mode,
@@ -98,7 +98,7 @@
this.minApiLevel = minApiLevel;
this.desugarJdkLibs = desugarJdkLibs;
this.customConversions = customConversions;
- this.desugaredLibraryConfigurationResources = desugaredLibraryConfigurationResources;
+ this.desugaredLibrarySpecificationResources = desugaredLibrarySpecificationResources;
this.withKeepRuleConsumer = withKeepRuleConsumer;
this.keepRuleConsumer = keepRuleConsumer;
this.mode = mode;
@@ -110,7 +110,7 @@
AndroidApiLevel minApiLevel;
private Path desugarJdkLibs;
private Path customConversions;
- private final List<StringResource> desugaredLibraryConfigurationResources = new ArrayList<>();
+ private final List<StringResource> desugaredLibrarySpecificationResources = new ArrayList<>();
boolean withKeepRuleConsumer = false;
KeepRuleConsumer keepRuleConsumer;
private CompilationMode mode = CompilationMode.DEBUG;
@@ -126,8 +126,8 @@
public Builder setConfiguration(Configuration configuration) {
desugarJdkLibs = configuration.desugarJdkLibs;
customConversions = configuration.customConversions;
- desugaredLibraryConfigurationResources.clear();
- desugaredLibraryConfigurationResources.add(
+ desugaredLibrarySpecificationResources.clear();
+ desugaredLibrarySpecificationResources.add(
StringResource.fromFile(configuration.configuration));
return this;
}
@@ -147,8 +147,8 @@
return this;
}
- public Builder addDesugaredLibraryConfiguration(StringResource desugaredLibraryConfiguration) {
- desugaredLibraryConfigurationResources.add(desugaredLibraryConfiguration);
+ public Builder addDesugaredLibraryConfiguration(StringResource desugaredLibrarySpecification) {
+ desugaredLibrarySpecificationResources.add(desugaredLibrarySpecification);
return this;
}
@@ -163,8 +163,8 @@
}
public LibraryDesugaringTestConfiguration build() {
- if (desugaredLibraryConfigurationResources.isEmpty()) {
- desugaredLibraryConfigurationResources.add(
+ if (desugaredLibrarySpecificationResources.isEmpty()) {
+ desugaredLibrarySpecificationResources.add(
StringResource.fromFile(ToolHelper.getDesugarLibJsonForTesting()));
}
if (withKeepRuleConsumer) {
@@ -174,7 +174,7 @@
minApiLevel,
desugarJdkLibs != null ? desugarJdkLibs : DEFAULT.desugarJdkLibs,
customConversions != null ? customConversions : DEFAULT.customConversions,
- desugaredLibraryConfigurationResources,
+ desugaredLibrarySpecificationResources,
withKeepRuleConsumer,
keepRuleConsumer,
mode,
@@ -205,7 +205,7 @@
if (keepRuleConsumer != null) {
builder.setDesugaredLibraryKeepRuleConsumer(keepRuleConsumer);
}
- desugaredLibraryConfigurationResources.forEach(builder::addDesugaredLibraryConfiguration);
+ desugaredLibrarySpecificationResources.forEach(builder::addDesugaredLibraryConfiguration);
}
public void configure(R8Command.Builder builder) {
@@ -215,7 +215,7 @@
if (keepRuleConsumer != null) {
builder.setDesugaredLibraryKeepRuleConsumer(keepRuleConsumer);
}
- desugaredLibraryConfigurationResources.forEach(builder::addDesugaredLibraryConfiguration);
+ desugaredLibrarySpecificationResources.forEach(builder::addDesugaredLibraryConfiguration);
}
public Path buildDesugaredLibrary(TestState state) {
@@ -230,12 +230,12 @@
}
String finalGeneratedKeepRules = generatedKeepRules;
try {
- assert desugaredLibraryConfigurationResources.size() == 1 : "There can be only one";
+ assert desugaredLibrarySpecificationResources.size() == 1 : "There can be only one";
return L8TestBuilder.create(minApiLevel, Backend.DEX, state)
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.P))
.setDesugarJDKLibs(desugarJdkLibs)
.setDesugarJDKLibsConfiguration(customConversions)
- .setDesugaredLibraryConfiguration(desugaredLibraryConfigurationResources.get(0))
+ .setDesugaredLibraryConfiguration(desugaredLibrarySpecificationResources.get(0))
.applyIf(
mode == CompilationMode.RELEASE,
builder -> {
diff --git a/src/test/java/com/android/tools/r8/R8CommandTest.java b/src/test/java/com/android/tools/r8/R8CommandTest.java
index 03f13ec..0b48fc2 100644
--- a/src/test/java/com/android/tools/r8/R8CommandTest.java
+++ b/src/test/java/com/android/tools/r8/R8CommandTest.java
@@ -765,7 +765,7 @@
public void desugaredLibrary() throws CompilationFailedException {
R8Command r8Command = parse("--desugared-lib", "src/library_desugar/desugar_jdk_libs.json");
assertFalse(
- r8Command.getInternalOptions().desugaredLibraryConfiguration.getRewritePrefix().isEmpty());
+ r8Command.getInternalOptions().desugaredLibrarySpecification.getRewritePrefix().isEmpty());
}
@Test
@@ -778,7 +778,7 @@
"--desugared-lib-pg-conf-output",
pgout.toString());
assertFalse(
- r8Command.getInternalOptions().desugaredLibraryConfiguration.getRewritePrefix().isEmpty());
+ r8Command.getInternalOptions().desugaredLibrarySpecification.getRewritePrefix().isEmpty());
}
@Test
diff --git a/src/test/java/com/android/tools/r8/R8TestBuilder.java b/src/test/java/com/android/tools/r8/R8TestBuilder.java
index 92270ae..1fa7630 100644
--- a/src/test/java/com/android/tools/r8/R8TestBuilder.java
+++ b/src/test/java/com/android/tools/r8/R8TestBuilder.java
@@ -666,8 +666,8 @@
public T enableCoreLibraryDesugaring(
AndroidApiLevel minApiLevel,
KeepRuleConsumer keepRuleConsumer,
- StringResource desugaredLibraryConfiguration) {
- super.enableCoreLibraryDesugaring(minApiLevel, keepRuleConsumer, desugaredLibraryConfiguration);
+ StringResource desugaredLibrarySpecification) {
+ super.enableCoreLibraryDesugaring(minApiLevel, keepRuleConsumer, desugaredLibrarySpecification);
return self();
}
diff --git a/src/test/java/com/android/tools/r8/TestCompilerBuilder.java b/src/test/java/com/android/tools/r8/TestCompilerBuilder.java
index 4a6db32..a66a4b2 100644
--- a/src/test/java/com/android/tools/r8/TestCompilerBuilder.java
+++ b/src/test/java/com/android/tools/r8/TestCompilerBuilder.java
@@ -484,12 +484,12 @@
public T enableCoreLibraryDesugaring(
AndroidApiLevel minApiLevel,
KeepRuleConsumer keepRuleConsumer,
- StringResource desugaredLibraryConfiguration) {
+ StringResource desugaredLibrarySpecification) {
return enableLibraryDesugaring(
LibraryDesugaringTestConfiguration.builder()
.setMinApi(minApiLevel)
.setKeepRuleConsumer(keepRuleConsumer)
- .addDesugaredLibraryConfiguration(desugaredLibraryConfiguration)
+ .addDesugaredLibraryConfiguration(desugaredLibrarySpecification)
.dontAddRunClasspath()
.build());
}
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/BufferedReaderTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/BufferedReaderTest.java
index f1ac89f..6b54606 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/BufferedReaderTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/BufferedReaderTest.java
@@ -10,8 +10,8 @@
import com.android.tools.r8.StringResource;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.ToolHelper;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.BooleanUtils;
import com.android.tools.r8.utils.InternalOptions;
@@ -60,11 +60,11 @@
: "Caught j$.io.UncheckedIOException");
}
- DesugaredLibraryConfiguration configurationAlternative3(
+ LegacyDesugaredLibrarySpecification configurationAlternative3(
InternalOptions options, boolean libraryCompilation, TestParameters parameters) {
// Parse the current configuration and amend the configuration for BufferedReader.lines. The
// configuration is the same for both program and library.
- return new DesugaredLibraryConfigurationParser(
+ return new LegacyDesugaredLibrarySpecificationParser(
options.dexItemFactory(),
options.reporter,
libraryCompilation,
@@ -73,11 +73,11 @@
}
private void configurationForProgramCompilation(InternalOptions options) {
- options.desugaredLibraryConfiguration = configurationAlternative3(options, false, parameters);
+ options.desugaredLibrarySpecification = configurationAlternative3(options, false, parameters);
}
private void configurationForLibraryCompilation(InternalOptions options) {
- options.desugaredLibraryConfiguration = configurationAlternative3(options, true, parameters);
+ options.desugaredLibrarySpecification = configurationAlternative3(options, true, parameters);
}
@Test
@@ -143,7 +143,7 @@
.addLibraryFiles(getLibraryFile())
.addOptionsModification(
options ->
- options.desugaredLibraryConfiguration =
+ options.desugaredLibrarySpecification =
configurationAlternative3(options, false, parameters))
.addInnerClasses(BufferedReaderTest.class)
.setMinApi(parameters.getApiLevel())
@@ -172,7 +172,7 @@
.addLibraryFiles(getLibraryFile())
.addOptionsModification(
options ->
- options.desugaredLibraryConfiguration =
+ options.desugaredLibrarySpecification =
configurationAlternative3(options, false, parameters))
.addInnerClasses(BufferedReaderTest.class)
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryCHMOnlyContentTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryCHMOnlyContentTest.java
index dc995e3..3e7d97d 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryCHMOnlyContentTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryCHMOnlyContentTest.java
@@ -8,8 +8,8 @@
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.ToolHelper;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.utils.InternalOptions;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import java.nio.file.Path;
@@ -44,7 +44,7 @@
false,
Collections.emptyList(),
options -> {
- options.desugaredLibraryConfiguration =
+ options.desugaredLibrarySpecification =
chmOnlyConfiguration(options, true, parameters);
});
CodeInspector inspector = new CodeInspector(desugaredLib);
@@ -62,16 +62,16 @@
true,
Collections.emptyList(),
options -> {
- options.desugaredLibraryConfiguration =
+ options.desugaredLibrarySpecification =
chmOnlyConfiguration(options, true, parameters);
});
CodeInspector inspector = new CodeInspector(desugaredLib);
assert inspector.clazz("j$.util.concurrent.ConcurrentHashMap").isPresent();
}
- DesugaredLibraryConfiguration chmOnlyConfiguration(
+ LegacyDesugaredLibrarySpecification chmOnlyConfiguration(
InternalOptions options, boolean libraryCompilation, TestParameters parameters) {
- return new DesugaredLibraryConfigurationParser(
+ return new LegacyDesugaredLibrarySpecificationParser(
options.dexItemFactory(),
options.reporter,
libraryCompilation,
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryConfigurationParsingTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryConfigurationParsingTest.java
index 2ef985e..efc5ce8 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryConfigurationParsingTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryConfigurationParsingTest.java
@@ -20,8 +20,8 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AbortException;
import com.android.tools.r8.utils.AndroidApiLevel;
@@ -70,10 +70,11 @@
ImmutableMap.<String, Object>builder()
.put(
"configuration_format_version",
- DesugaredLibraryConfigurationParser.MAX_SUPPORTED_VERSION)
+ LegacyDesugaredLibrarySpecificationParser.MAX_SUPPORTED_VERSION)
.put("group_id", "com.tools.android")
.put("artifact_id", "desugar_jdk_libs")
- .put("version", DesugaredLibraryConfigurationParser.MIN_SUPPORTED_VERSION.toString())
+ .put(
+ "version", LegacyDesugaredLibrarySpecificationParser.MIN_SUPPORTED_VERSION.toString())
.put("required_compilation_api_level", 1)
.put("synthesized_library_classes_package_prefix", "j$.")
.put("common_flags", Collections.emptyList())
@@ -85,20 +86,20 @@
return new LinkedHashMap<>(TEMPLATE);
}
- private DesugaredLibraryConfigurationParser parser(DiagnosticsHandler handler) {
- return new DesugaredLibraryConfigurationParser(
+ private LegacyDesugaredLibrarySpecificationParser parser(DiagnosticsHandler handler) {
+ return new LegacyDesugaredLibrarySpecificationParser(
factory, new Reporter(handler), libraryCompilation, minApi.getLevel());
}
- private DesugaredLibraryConfiguration runPassing(String resource) {
+ private LegacyDesugaredLibrarySpecification runPassing(String resource) {
return runPassing(StringResource.fromString(resource, origin));
}
- private DesugaredLibraryConfiguration runPassing(StringResource resource) {
+ private LegacyDesugaredLibrarySpecification runPassing(StringResource resource) {
TestDiagnosticMessagesImpl handler = new TestDiagnosticMessagesImpl();
- DesugaredLibraryConfiguration config = parser(handler).parse(resource);
+ LegacyDesugaredLibrarySpecification spec = parser(handler).parse(resource);
handler.assertNoMessages();
- return config;
+ return spec;
}
private void runFailing(String json, Consumer<TestDiagnosticMessages> checker) {
@@ -114,9 +115,9 @@
@Test
public void testReference() throws Exception {
// Just test that the reference file parses without issues.
- DesugaredLibraryConfiguration config =
+ LegacyDesugaredLibrarySpecification spec =
runPassing(StringResource.fromFile(ToolHelper.getDesugarLibJsonForTesting()));
- assertEquals(libraryCompilation, config.isLibraryCompilation());
+ assertEquals(libraryCompilation, spec.isLibraryCompilation());
}
@Test
@@ -161,7 +162,7 @@
@Test
public void testUnsupportedVersion() {
LinkedHashMap<String, Object> data = template();
- SemanticVersion minVersion = DesugaredLibraryConfigurationParser.MIN_SUPPORTED_VERSION;
+ SemanticVersion minVersion = LegacyDesugaredLibrarySpecificationParser.MIN_SUPPORTED_VERSION;
data.put(
"version",
new SemanticVersion(minVersion.getMajor(), minVersion.getMinor(), minVersion.getPatch() - 1)
@@ -255,15 +256,15 @@
"java.util.Foo", "j$.util.FooConv1",
"java.util.Foo2", "j$.util.FooConv2"))));
// The gson parser will overwrite the key in order during parsing, thus hiding potential issues.
- DesugaredLibraryConfiguration config = runPassing(toJson(data).replace("Foo2", "Foo"));
+ LegacyDesugaredLibrarySpecification spec = runPassing(toJson(data).replace("Foo2", "Foo"));
assertEquals(
Collections.singletonList("java.util.Foo"),
- config.getCustomConversions().keySet().stream()
+ spec.getCustomConversions().keySet().stream()
.map(DexType::toString)
.collect(Collectors.toList()));
assertEquals(
Collections.singletonList("j$.util.FooConv2"),
- config.getCustomConversions().values().stream()
+ spec.getCustomConversions().values().stream()
.map(DexType::toString)
.collect(Collectors.toList()));
}
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
index 91b87a0..1409ec7 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
@@ -14,7 +14,7 @@
import com.android.tools.r8.StringResource;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.errors.DesugaredLibraryMismatchDiagnostic;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.Box;
@@ -193,7 +193,7 @@
public void testMergeDifferentLibraryDesugarVersions() throws Exception {
// DEX code with library desugaring using a desugared library configuration with a
// different identifier.
- Box<DesugaredLibraryConfiguration> box = new Box<>();
+ Box<LegacyDesugaredLibrarySpecification> box = new Box<>();
Path libraryDex =
testForD8(Backend.DEX)
.addProgramClasses(Library.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryTestBase.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryTestBase.java
index e57aaa9..d4a48f8 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryTestBase.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryTestBase.java
@@ -24,8 +24,8 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.ToolHelper.DexVm.Version;
import com.android.tools.r8.errors.Unreachable;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.tracereferences.TraceReferences;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.FileUtils;
@@ -227,12 +227,12 @@
return desugaredLib;
}
- protected DesugaredLibraryConfiguration configurationWithSupportAllCallbacksFromLibrary(
+ protected LegacyDesugaredLibrarySpecification configurationWithSupportAllCallbacksFromLibrary(
InternalOptions options,
boolean libraryCompilation,
TestParameters parameters,
boolean supportAllCallbacksFromLibrary) {
- return new DesugaredLibraryConfigurationParser(
+ return new LegacyDesugaredLibrarySpecificationParser(
options.dexItemFactory(),
options.reporter,
libraryCompilation,
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ExtractWrapperTypesTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ExtractWrapperTypesTest.java
index 5c42b95..21dc2f9 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ExtractWrapperTypesTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ExtractWrapperTypesTest.java
@@ -16,8 +16,8 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.naming.MemberNaming.MethodSignature;
import com.android.tools.r8.references.ClassReference;
import com.android.tools.r8.references.MethodReference;
@@ -128,11 +128,11 @@
CodeInspector desugaredApiJar = getDesugaredApiJar();
Set<ClassReference> preDesugarTypes = getPreDesugarTypes();
- DesugaredLibraryConfiguration conf = getDesugaredLibraryConfiguration();
+ LegacyDesugaredLibrarySpecification spec = getDesugaredLibraryConfiguration();
Set<String> wrappersInSpec =
- conf.getWrapperConversions().stream().map(DexType::toString).collect(Collectors.toSet());
+ spec.getWrapperConversions().stream().map(DexType::toString).collect(Collectors.toSet());
Set<String> customConversionsInSpec =
- conf.getCustomConversions().keySet().stream()
+ spec.getCustomConversions().keySet().stream()
.map(DexType::toString)
.collect(Collectors.toSet());
assertEquals(
@@ -191,9 +191,9 @@
return missingWrappers;
}
- private DesugaredLibraryConfiguration getDesugaredLibraryConfiguration() {
- DesugaredLibraryConfigurationParser parser =
- new DesugaredLibraryConfigurationParser(
+ private LegacyDesugaredLibrarySpecification getDesugaredLibraryConfiguration() {
+ LegacyDesugaredLibrarySpecificationParser parser =
+ new LegacyDesugaredLibrarySpecificationParser(
new DexItemFactory(), null, true, minApi.getLevel());
return parser.parse(StringResource.fromFile(ToolHelper.getDesugarLibJsonForTesting()));
}
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/InconsistentPrefixTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/InconsistentPrefixTest.java
index 43056e6..b1f57e1 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/InconsistentPrefixTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/InconsistentPrefixTest.java
@@ -10,7 +10,7 @@
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.jasmin.JasminBuilder;
import java.nio.file.Path;
import java.util.HashMap;
@@ -48,8 +48,8 @@
.addProgramFiles(inputJar)
.addOptionsModification(
options ->
- options.desugaredLibraryConfiguration =
- DesugaredLibraryConfiguration.withOnlyRewritePrefixForTesting(x, options))
+ options.desugaredLibrarySpecification =
+ LegacyDesugaredLibrarySpecification.withOnlyRewritePrefixForTesting(x, options))
.compileWithExpectedDiagnostics(
diagnostics -> {
diagnostics.assertErrorMessageThatMatches(
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/LintFilesTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/LintFilesTest.java
index 283900e..18af69f 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/LintFilesTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/LintFilesTest.java
@@ -14,8 +14,8 @@
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.graph.DexItemFactory;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.FileUtils;
import com.android.tools.r8.utils.InternalOptions;
@@ -125,8 +125,8 @@
directory.toString()
});
InternalOptions options = new InternalOptions(new DexItemFactory(), new Reporter());
- DesugaredLibraryConfiguration desugaredLibraryConfiguration =
- new DesugaredLibraryConfigurationParser(
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification =
+ new LegacyDesugaredLibrarySpecificationParser(
options.itemFactory, options.reporter, false, AndroidApiLevel.B.getLevel())
.parse(StringResource.fromFile(ToolHelper.getDesugarLibJsonForTesting()));
@@ -136,7 +136,7 @@
}
Path compileApiLevelDirectory = directory.resolve("compile_api_level_" + apiLevel.getLevel());
if (apiLevel.getLevel()
- < desugaredLibraryConfiguration.getRequiredCompilationApiLevel().getLevel()) {
+ < desugaredLibrarySpecification.getRequiredCompilationApiLevel().getLevel()) {
System.out.println("!Checking " + compileApiLevelDirectory);
continue;
}
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ObjectsTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ObjectsTest.java
index b2973f5..abdf5c5 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ObjectsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/ObjectsTest.java
@@ -15,8 +15,8 @@
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfigurationParser;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecificationParser;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.BooleanUtils;
import com.android.tools.r8.utils.InternalOptions;
@@ -84,9 +84,9 @@
ToolHelper.getAndroidJar(Ordered.max(parameters.getApiLevel(), AndroidApiLevel.O));
}
- DesugaredLibraryConfiguration desugaredLibraryConfiguration(
+ LegacyDesugaredLibrarySpecification desugaredLibrarySpecification(
InternalOptions options, boolean libraryCompilation, TestParameters parameters) {
- return new DesugaredLibraryConfigurationParser(
+ return new LegacyDesugaredLibrarySpecificationParser(
options.dexItemFactory(),
options.reporter,
libraryCompilation,
@@ -99,13 +99,13 @@
}
private void configurationForProgramCompilation(InternalOptions options) {
- options.desugaredLibraryConfiguration =
- desugaredLibraryConfiguration(options, false, parameters);
+ options.desugaredLibrarySpecification =
+ desugaredLibrarySpecification(options, false, parameters);
}
private void configurationForLibraryCompilation(InternalOptions options) {
- options.desugaredLibraryConfiguration =
- desugaredLibraryConfiguration(options, true, parameters);
+ options.desugaredLibrarySpecification =
+ desugaredLibrarySpecification(options, true, parameters);
}
private Matcher<MethodSubject> invokesObjectsCompare(String holder) {
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/RetargetAndBackportTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/RetargetAndBackportTest.java
index 6b29a83..d077f3f 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/RetargetAndBackportTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/RetargetAndBackportTest.java
@@ -7,7 +7,7 @@
import static org.junit.Assert.assertTrue;
import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.codeinspector.InstructionSubject;
@@ -53,8 +53,8 @@
*/
.addOptionsModifier(
options ->
- options.desugaredLibraryConfiguration =
- DesugaredLibraryConfiguration.builder(
+ options.desugaredLibrarySpecification =
+ LegacyDesugaredLibrarySpecification.builder(
options.dexItemFactory(), options.reporter, Origin.unknown())
.setDesugaredLibraryIdentifier("my-identifier")
.putRewritePrefix("java.time.", "j$.time.")
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/AccessModeConversionTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/AccessModeConversionTest.java
index d392dd8..e242349 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/AccessModeConversionTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/AccessModeConversionTest.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.desugar.desugaredlibrary.DesugaredLibraryTestBase;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.BooleanUtils;
@@ -57,8 +57,8 @@
}
private void configureDesugaredLibrary(InternalOptions options, boolean l8Compilation) {
- DesugaredLibraryConfiguration.Builder builder =
- DesugaredLibraryConfiguration.builder(
+ LegacyDesugaredLibrarySpecification.Builder builder =
+ LegacyDesugaredLibrarySpecification.builder(
options.itemFactory, options.reporter, Origin.unknown())
.setDesugaredLibraryIdentifier("com.tools.android:desugar_jdk_libs:9.99.99")
.putRewritePrefix("java.nio.file.AccessMode", "j$.nio.file.AccessMode")
@@ -66,7 +66,7 @@
if (l8Compilation) {
builder.setLibraryCompilation();
}
- options.desugaredLibraryConfiguration = builder.build();
+ options.desugaredLibrarySpecification = builder.build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/ConversionIntroduceInterfaceMethodTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/ConversionIntroduceInterfaceMethodTest.java
index a205079..aa97e55 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/ConversionIntroduceInterfaceMethodTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/ConversionIntroduceInterfaceMethodTest.java
@@ -87,7 +87,7 @@
.enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
.addOptionsModification(
opt ->
- opt.desugaredLibraryConfiguration =
+ opt.desugaredLibrarySpecification =
configurationWithSupportAllCallbacksFromLibrary(
opt, false, parameters, supportAllCallbacksFromLibrary))
.compile()
@@ -151,7 +151,7 @@
.enableCoreLibraryDesugaring(parameters.getApiLevel(), keepRuleConsumer)
.addOptionsModification(
opt ->
- opt.desugaredLibraryConfiguration =
+ opt.desugaredLibrarySpecification =
configurationWithSupportAllCallbacksFromLibrary(
opt, false, parameters, supportAllCallbacksFromLibrary))
.compile()
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/DuplicateAPIDesugaredLibTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/DuplicateAPIDesugaredLibTest.java
index 1fa4a7c..6b7d86e 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/DuplicateAPIDesugaredLibTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/conversiontests/DuplicateAPIDesugaredLibTest.java
@@ -71,7 +71,7 @@
this.buildDesugaredLibrary(
api,
opt ->
- opt.desugaredLibraryConfiguration =
+ opt.desugaredLibrarySpecification =
configurationWithSupportAllCallbacksFromLibrary(
opt, true, parameters, supportAllCallbacksFromLibrary)));
return desugaredLibBox.get();
diff --git a/src/test/java/com/android/tools/r8/memberrebinding/b135627418/B135627418.java b/src/test/java/com/android/tools/r8/memberrebinding/b135627418/B135627418.java
index 06a87e4..f3103f1 100644
--- a/src/test/java/com/android/tools/r8/memberrebinding/b135627418/B135627418.java
+++ b/src/test/java/com/android/tools/r8/memberrebinding/b135627418/B135627418.java
@@ -12,7 +12,7 @@
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
-import com.android.tools.r8.ir.desugar.desugaredlibrary.DesugaredLibraryConfiguration;
+import com.android.tools.r8.ir.desugar.desugaredlibrary.legacyspecification.LegacyDesugaredLibrarySpecification;
import com.android.tools.r8.memberrebinding.b135627418.library.Drawable;
import com.android.tools.r8.memberrebinding.b135627418.library.DrawableWrapper;
import com.android.tools.r8.memberrebinding.b135627418.library.InsetDrawable;
@@ -76,8 +76,8 @@
.setMinApi(parameters.getRuntime())
.addOptionsModification(
options ->
- options.desugaredLibraryConfiguration =
- DesugaredLibraryConfiguration.withOnlyRewritePrefixForTesting(
+ options.desugaredLibrarySpecification =
+ LegacyDesugaredLibrarySpecification.withOnlyRewritePrefixForTesting(
ImmutableMap.of(packageName + ".runtime", packageName + ".library"),
options))
.compile();