diff --git a/robolectric/src/main/java/org/robolectric/ConfigMerger.java b/robolectric/src/main/java/org/robolectric/ConfigMerger.java
deleted file mode 100644
index b2b5a8ae877..00000000000
--- a/robolectric/src/main/java/org/robolectric/ConfigMerger.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.robolectric;
-
-import static com.google.common.collect.Lists.reverse;
-
-import com.google.common.annotations.VisibleForTesting;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.robolectric.annotation.Config;
-import org.robolectric.util.Join;
-
-/**
- * Computes the effective Robolectric configuration for a given test method.
- *
- *
This class is no longer used directly by Robolectric, but is left for convenience during
- * migration.
- *
- * @deprecated Provide an implementation of {@link javax.inject.Provider}. This class will
- * be removed in Robolectric 4.3.
- * @see Migration Notes for more
- * details.
- */
-@Deprecated
-public class ConfigMerger {
- private final Map packageConfigCache = new LinkedHashMap() {
- @Override
- protected boolean removeEldestEntry(Map.Entry eldest) {
- return size() > 10;
- }
- };
-
- /**
- * Calculate the {@link Config} for the given test.
- *
- * @param testClass the class containing the test
- * @param method the test method
- * @param globalConfig global configuration values
- * @return the effective configuration
- * @since 3.2
- */
- public Config getConfig(Class> testClass, Method method, Config globalConfig) {
- Config config = Config.Builder.defaults().build();
- config = override(config, globalConfig);
-
- for (String packageName : reverse(packageHierarchyOf(testClass))) {
- Config packageConfig = cachedPackageConfig(packageName);
- config = override(config, packageConfig);
- }
-
- for (Class clazz : reverse(parentClassesFor(testClass))) {
- Config classConfig = (Config) clazz.getAnnotation(Config.class);
- config = override(config, classConfig);
- }
-
- Config methodConfig = method.getAnnotation(Config.class);
- config = override(config, methodConfig);
-
- return config;
- }
-
- /**
- * Generate {@link Config} for the specified package.
- *
- * More specific packages, test classes, and test method configurations
- * will override values provided here.
- *
- * The default implementation uses properties provided by {@link #getConfigProperties(String)}.
- *
- * The returned object is likely to be reused for many tests.
- *
- * @param packageName the name of the package, or empty string ({@code ""}) for the top level package
- * @return {@link Config} object for the specified package
- * @since 3.2
- */
- @Nullable
- private Config buildPackageConfig(String packageName) {
- return Config.Implementation.fromProperties(getConfigProperties(packageName));
- }
-
- /**
- * Return a {@link Properties} file for the given package name, or {@code null} if none is available.
- *
- * @since 3.2
- */
- protected Properties getConfigProperties(String packageName) {
- List packageParts = new ArrayList<>(Arrays.asList(packageName.split("\\.")));
- packageParts.add(RobolectricTestRunner.CONFIG_PROPERTIES);
- final String resourceName = Join.join("/", packageParts);
- try (InputStream resourceAsStream = getResourceAsStream(resourceName)) {
- if (resourceAsStream == null) return null;
- Properties properties = new Properties();
- properties.load(resourceAsStream);
- return properties;
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Nonnull @VisibleForTesting
- List packageHierarchyOf(Class> javaClass) {
- Package aPackage = javaClass.getPackage();
- String testPackageName = aPackage == null ? "" : aPackage.getName();
- List packageHierarchy = new ArrayList<>();
- while (!testPackageName.isEmpty()) {
- packageHierarchy.add(testPackageName);
- int lastDot = testPackageName.lastIndexOf('.');
- testPackageName = lastDot > 1 ? testPackageName.substring(0, lastDot) : "";
- }
- packageHierarchy.add("");
- return packageHierarchy;
- }
-
- @Nonnull
- private List parentClassesFor(Class testClass) {
- List testClassHierarchy = new ArrayList<>();
- while (testClass != null && !testClass.equals(Object.class)) {
- testClassHierarchy.add(testClass);
- testClass = testClass.getSuperclass();
- }
- return testClassHierarchy;
- }
-
- private Config override(Config config, Config classConfig) {
- return classConfig != null ? new Config.Builder(config).overlay(classConfig).build() : config;
- }
-
- @Nullable
- private Config cachedPackageConfig(String packageName) {
- synchronized (packageConfigCache) {
- Config config = packageConfigCache.get(packageName);
- if (config == null && !packageConfigCache.containsKey(packageName)) {
- config = buildPackageConfig(packageName);
- packageConfigCache.put(packageName, config);
- }
- return config;
- }
- }
-
- // visible for testing
- @SuppressWarnings("WeakerAccess")
- InputStream getResourceAsStream(String resourceName) {
- return getClass().getClassLoader().getResourceAsStream(resourceName);
- }
-}
diff --git a/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java b/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java
index 4cfb8f30c47..a6e07eae38f 100644
--- a/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java
+++ b/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java
@@ -62,7 +62,11 @@
@SuppressWarnings("NewApi")
public class RobolectricTestRunner extends SandboxTestRunner {
- public static final String CONFIG_PROPERTIES = "robolectric.properties";
+ /**
+ * @deprecated No longer used. This constant will be removed in a future version of Robolectric.
+ */
+ @Deprecated public static final String CONFIG_PROPERTIES = "robolectric.properties";
+
private static final Injector DEFAULT_INJECTOR = defaultInjector().build();
private static final Map appManifestsCache = new HashMap<>();
@@ -106,7 +110,7 @@ protected RobolectricTestRunner(final Class> testClass, Injector injector)
super(testClass, injector);
if (DeprecatedTestRunnerDefaultConfigProvider.globalConfig == null) {
- DeprecatedTestRunnerDefaultConfigProvider.globalConfig = buildGlobalConfig();
+ DeprecatedTestRunnerDefaultConfigProvider.globalConfig = new Config.Builder().build();
}
this.sandboxManager = injector.getInstance(SandboxManager.class);
@@ -415,30 +419,6 @@ private Configuration getConfiguration(Method method) {
return configurationStrategy.getConfig(getTestClass().getJavaClass(), method);
}
- /**
- * Provides the base Robolectric configuration {@link Config} used for all tests.
- *
- * Configuration provided for specific packages, test classes, and test method configurations
- * will override values provided here.
- *
- *
Custom TestRunner subclasses may wish to override this method to provide alternate
- * configuration. Consider using a {@link Config.Builder}.
- *
- *
The default implementation has appropriate values for most use cases.
- *
- * @return global {@link Config} object
- * @deprecated Provide a service implementation of {@link GlobalConfigProvider} instead. This
- * method will be removed in Robolectric 4.3.
- * @since 3.1.3
- * @see Migration Notes for more
- * details.
- */
- @Deprecated
- @SuppressWarnings("InlineMeSuggester")
- protected Config buildGlobalConfig() {
- return new Config.Builder().build();
- }
-
@AutoService(GlobalConfigProvider.class)
@Priority(Integer.MIN_VALUE)
@Deprecated
diff --git a/shadows/framework/src/main/java/org/robolectric/android/controller/ServiceController.java b/shadows/framework/src/main/java/org/robolectric/android/controller/ServiceController.java
index 1c518236579..18329cee8d2 100644
--- a/shadows/framework/src/main/java/org/robolectric/android/controller/ServiceController.java
+++ b/shadows/framework/src/main/java/org/robolectric/android/controller/ServiceController.java
@@ -91,15 +91,4 @@ public ServiceController unbind() {
shadowMainLooper.idleIfPaused();
return this;
}
-
- /**
- * @deprecated Use the appropriate builder in {@link org.robolectric.Robolectric} instead.
- *
- * This method will be removed in Robolectric 3.6.
- */
- @Deprecated
- public ServiceController withIntent(Intent intent) {
- this.intent = intent;
- return this;
- }
}