Fix javac warnings
Change-Id: Ifcbadae643533e575090cdf95f0bf7ffae2e04ed
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
index 87ff91c..54310ee 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/ConfigLoader.java
@@ -63,7 +63,8 @@
new InputStreamReader(getClass().getResourceAsStream(configKeysPath), Charsets.UTF_8)) {
String automergerConfigYamlString = CharStreams.toString(streamReader);
- Map automergerConfig = (Map) (new Yaml().load(automergerConfigYamlString));
+ Map<String, Object> automergerConfig =
+ (Map<String, Object>) (new Yaml().load(automergerConfigYamlString));
configProject = (String) automergerConfig.get("config_project");
configProjectBranch = (String) automergerConfig.get("config_project_branch");
configFilename = (String) automergerConfig.get("config_filename");
@@ -170,7 +171,7 @@
public Set<String> getDownstreamBranches(String fromBranch, String project)
throws RestApiException, IOException {
Set<String> downstreamBranches = new HashSet<String>();
- Map<String, Map> fromBranchConfig = config.getMergeConfig(fromBranch);
+ Map<String, Object> fromBranchConfig = config.getMergeConfig(fromBranch);
if (fromBranchConfig != null) {
for (String key : fromBranchConfig.keySet()) {
@@ -197,7 +198,7 @@
// Returns contents of manifest file for the given branch.
// If manifest does not exist, return empty set.
private Set<String> getManifestProjects(String fromBranch) throws RestApiException, IOException {
- Map fromBranchConfig = config.getMergeConfig(fromBranch);
+ Map<String, Object> fromBranchConfig = config.getMergeConfig(fromBranch);
if (fromBranchConfig == null) {
return new HashSet<>();
}
@@ -232,7 +233,7 @@
}
}
- private void applyConfig(Set<String> projects, Map givenConfig) {
+ private void applyConfig(Set<String> projects, Map<String, Object> givenConfig) {
if (givenConfig == null) {
return;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/LoadedConfig.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/LoadedConfig.java
index 058a879..d5c7833 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/LoadedConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/LoadedConfig.java
@@ -35,7 +35,7 @@
private static final Logger log = LoggerFactory.getLogger(LoadedConfig.class);
private final Map<String, Object> global;
- private final Map<String, Map> config;
+ private final Map<String, Map<String, ?>> config;
private final Map<String, String> defaultManifestInfo;
private final Pattern blankMergePattern;
private final Pattern alwaysBlankMergePattern;
@@ -63,7 +63,7 @@
BinaryResult configFile =
gApi.projects().name(configProject).branch(configProjectBranch).file(configFilename);
String configFileString = configFile.asString();
- config = (Map<String, Map>) (new Yaml().load(configFileString));
+ config = (Map<String, Map<String, ?>>) (new Yaml().load(configFileString));
global = (Map<String, Object>) config.get("global");
defaultManifestInfo = (Map<String, String>) global.get("manifest");
@@ -108,7 +108,7 @@
* @return A map of config keys to their values, or a map of "to branches" to a map of config keys
* to their values.
*/
- public Map<String, Map> getMergeConfig(String fromBranch) {
+ public Map<String, Object> getMergeConfig(String fromBranch) {
return getBranches().get(fromBranch);
}
@@ -120,7 +120,7 @@
* @return Map of configuration keys to their values.
*/
public Map<String, Object> getMergeConfig(String fromBranch, String toBranch) {
- Map<String, Map> fromBranchConfig = getBranches().get(fromBranch);
+ Map<String, Object> fromBranchConfig = getBranches().get(fromBranch);
if (fromBranchConfig == null) {
return Collections.emptyMap();
}
@@ -132,8 +132,9 @@
*
* @return A map of from branches to their configuration maps.
*/
- public Map<String, Map> getBranches() {
- return (Map<String, Map>) config.getOrDefault("branches", Collections.emptyMap());
+ public Map<String, Map<String, Object>> getBranches() {
+ return (Map<String, Map<String, Object>>)
+ config.getOrDefault("branches", Collections.<String, Map<String, Object>>emptyMap());
}
/**
@@ -167,7 +168,7 @@
* Gets the value of a global attribute.
*
* @param key A configuration key that is defined in the config.
- * @return The value of the global attribute.
+ * @return The value of the global attribute
*/
public Object getGlobalAttribute(String key) {
return global.get(key);