< prev index next >
./test/lib/jdk/test/lib/artifacts/ArtifactResolver.java
Print this page
rev 2600 : 8179930: jdk.test.lib.artifacts.ArtifactResolver::resolve should return Map instead of HashMap
Reviewed-by: duke
*** 24,36 ****
package jdk.test.lib.artifacts;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.util.HashMap;
public class ArtifactResolver {
! public static HashMap<String, Path> resolve(Class klass) throws FileNotFoundException {
ArtifactManager manager = new DefaultArtifactManager();
try {
String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager");
if (managerName != null) {
manager = (ArtifactManager) Class.forName(managerName).newInstance();
--- 24,37 ----
package jdk.test.lib.artifacts;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.util.HashMap;
+ import java.util.Map;
public class ArtifactResolver {
! public static Map<String, Path> resolve(Class<?> klass) throws FileNotFoundException {
ArtifactManager manager = new DefaultArtifactManager();
try {
String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager");
if (managerName != null) {
manager = (ArtifactManager) Class.forName(managerName).newInstance();
*** 39,54 ****
}
} catch (Exception e) {
// If we end up here, we'll use the DefaultArtifactManager
}
! ArtifactContainer artifactContainer = (ArtifactContainer) klass.getAnnotation(ArtifactContainer.class);
HashMap<String, Path> locations = new HashMap<>();
Artifact[] artifacts;
if (artifactContainer == null) {
! artifacts = new Artifact[]{(Artifact) klass.getAnnotation(Artifact.class)};
} else {
artifacts = artifactContainer.value();
}
for (Artifact artifact : artifacts) {
locations.put(artifactName(artifact), manager.resolve(artifact));
--- 40,55 ----
}
} catch (Exception e) {
// If we end up here, we'll use the DefaultArtifactManager
}
! ArtifactContainer artifactContainer = klass.getAnnotation(ArtifactContainer.class);
HashMap<String, Path> locations = new HashMap<>();
Artifact[] artifacts;
if (artifactContainer == null) {
! artifacts = new Artifact[]{klass.getAnnotation(Artifact.class)};
} else {
artifacts = artifactContainer.value();
}
for (Artifact artifact : artifacts) {
locations.put(artifactName(artifact), manager.resolve(artifact));
< prev index next >