Skip to content

Commit 2131d6b

Browse files
committed
Fix a bunch of Eclipse warnings
1 parent 2150a0c commit 2131d6b

File tree

9 files changed

+23
-28
lines changed

9 files changed

+23
-28
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ Institute of Molecular Cell Biology and Genetics, and KNIME GmbH.</license.copyr
214214
<dependency>
215215
<groupId>org.scijava</groupId>
216216
<artifactId>scijava-common</artifactId>
217-
<version>${scijava-common.version}</version>
218217
</dependency>
219218
</dependencies>
220219

src/main/java/org/scijava/maven/plugin/BumpMojo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ private String latestVersion(final String groupId, final String artifactId)
137137
new DefaultArtifact(groupId, artifactId, null, "[0,)");
138138
request.setArtifact(artifact);
139139
makeImageJRepositoryKnown();
140-
final List<RemoteRepository> repositories =
141-
new ArrayList<RemoteRepository>();
140+
final List<RemoteRepository> repositories = new ArrayList<>();
142141
repositories.addAll(remoteRepositories);
143142
request.setRepositories(repositories);
144143
VersionRangeResult result;

src/main/java/org/scijava/maven/plugin/DependencyUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ public static List<MavenProject> findEffectiveReactor(
157157
final MavenProject baseProject, final MavenProjectBuilder projectBuilder,
158158
final ArtifactRepository localRepository) throws ProjectBuildingException
159159
{
160-
final Set<MavenProject> reactor = new HashSet<MavenProject>();
161-
final Set<MavenProject> visited = new HashSet<MavenProject>();
160+
final Set<MavenProject> reactor = new HashSet<>();
161+
final Set<MavenProject> visited = new HashSet<>();
162162
final ProfileManager profileManager = getProfileManager(session);
163163

164164
findEffectiveReactor(reactor, visited, baseProject, baseProject,
165165
projectBuilder, localRepository, profileManager);
166166

167167
if (reactor.size() <= 1 || !reactor.contains(baseProject)) return defaultReactor;
168-
return new ArrayList<MavenProject>(reactor);
168+
return new ArrayList<>(reactor);
169169
}
170170

171171
// -- Helper methods --

src/main/java/org/scijava/maven/plugin/EclipseHelperMojo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public void execute() throws MojoExecutionException {
7979

8080
getLog().info("Parsing SciJava annotations");
8181
try {
82-
@SuppressWarnings("unchecked")
8382
final List<String> elements =
8483
currentProject.getCompileClasspathElements();
8584
final URL[] classpath = new URL[elements.size() + 1];
@@ -138,7 +137,6 @@ public void execute() throws MojoExecutionException {
138137
* @return true iff the project depends on <code>scijava-common</code>
139138
*/
140139
private boolean dependsOnScijavaCommon(final MavenProject project) {
141-
@SuppressWarnings("unchecked")
142140
final List<Dependency> dependencies = project.getCompileDependencies();
143141
if (dependencies == null) return false;
144142

src/main/java/org/scijava/maven/plugin/SnapshotFinder.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,22 @@ public class SnapshotFinder extends AbstractSciJavaDependencyChecker {
6363

6464
// -- Parameters --
6565

66-
@SuppressWarnings("rawtypes")
67-
private final List remoteRepositories;
66+
private final List<ArtifactRepository> remoteRepositories;
6867
private final MavenProjectBuilder projectBuilder;
6968
private final ArtifactRepository localRepository;
7069

7170
// -- Fields --
7271

7372
private final Map<DependencyNode, Result> results =
74-
new HashMap<DependencyNode, Result>();
73+
new HashMap<>();
7574

76-
private Set<MavenProject> reactorModules = new HashSet<MavenProject>();
75+
private Set<MavenProject> reactorModules = new HashSet<>();
7776

7877
// -- Constructor --
7978

8079
public SnapshotFinder(final MavenProjectBuilder projectBuilder,
8180
final ArtifactRepository localRepository,
82-
@SuppressWarnings("rawtypes") final List remoteRepositories)
81+
final List<ArtifactRepository> remoteRepositories)
8382
{
8483
this.projectBuilder = projectBuilder;
8584
this.localRepository = localRepository;
@@ -103,7 +102,7 @@ public SnapshotFinder(final MavenProjectBuilder projectBuilder,
103102
* reactor.
104103
*/
105104
public void setReactorModules(final List<MavenProject> modules) {
106-
reactorModules = new HashSet<MavenProject>(modules);
105+
reactorModules = new HashSet<>(modules);
107106
}
108107

109108
@Override
@@ -117,7 +116,7 @@ public String makeExceptionMessage() {
117116
// Because we are using the Maven 2 DependencyTree, artifacts can be listed
118117
// multiple times if multiple components depend on them. Thus we need to
119118
// merge our dependencies to a set of artifacts.
120-
final Map<Artifact, Result> mergedResults = new HashMap<Artifact, Result>();
119+
final Map<Artifact, Result> mergedResults = new HashMap<>();
121120

122121
for (final DependencyNode node : results.keySet()) {
123122
final Artifact a = node.getArtifact();

src/main/java/org/scijava/maven/plugin/VerifyNoSnapshotsMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
138138
// -- Helper methods --
139139

140140
private Set<String> getGroupIds() {
141-
final Set<String> ids = new HashSet<String>();
141+
final Set<String> ids = new HashSet<>();
142142
if (groupIds != null) {
143143
for (final Object id : groupIds)
144144
ids.add(id == null ? null : id.toString());

src/main/java/org/scijava/maven/plugin/enforcer/RequireReproducibleBuilds.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void execute(final EnforcerRuleHelper helper)
111111
}
112112

113113
// populate groupIds
114-
final Set<String> ids = new HashSet<String>();
114+
final Set<String> ids = new HashSet<>();
115115
if (groupId != null) ids.add(groupId);
116116
if (groupIds != null) {
117117
for (final String id : groupIds.split(",")) {

src/main/java/org/scijava/maven/plugin/install/AbstractCopyJarsMojo.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ protected boolean hasIJ1Dependency(final MavenProject project) {
281281
}
282282

283283
protected String interpolate(final String original,
284-
final MavenProject project, final MavenSession session)
284+
final MavenProject project)
285285
throws MojoExecutionException
286286
{
287287
if (original == null || original.indexOf("${") < 0) return original;
@@ -324,41 +324,41 @@ protected String interpolate(final String original,
324324
}
325325

326326
protected void installArtifact(final Artifact artifact,
327-
final File appDirectory, final boolean force,
327+
final File appDir, final boolean force,
328328
final OtherVersions otherVersionsPolicy) throws IOException
329329
{
330-
installArtifact(artifact, appDirectory, "", force, otherVersionsPolicy);
330+
installArtifact(artifact, appDir, "", force, otherVersionsPolicy);
331331
}
332332

333333
protected void installArtifact(final Artifact artifact,
334-
final File appDirectory, final String appSubdirectory, final boolean force,
334+
final File appDir, final String appSubdir, final boolean force,
335335
final OtherVersions otherVersionsPolicy) throws IOException
336336
{
337337
if (!"jar".equals(artifact.getType())) return;
338338

339339
final File source = artifact.getFile();
340340
final File targetDirectory;
341341

342-
if (appSubdirectory != null && !appSubdirectory.equals("")) {
343-
targetDirectory = new File(appDirectory, appSubdirectory);
342+
if (appSubdir != null && !appSubdir.equals("")) {
343+
targetDirectory = new File(appDir, appSubdir);
344344
} else if (isIJ1Plugin(source)) {
345-
targetDirectory = new File(appDirectory, "plugins");
345+
targetDirectory = new File(appDir, "plugins");
346346
}
347347
else if ("ome".equals(artifact.getGroupId()) ||
348348
("loci".equals(artifact.getGroupId()) && (source.getName().startsWith(
349349
"scifio-4.4.") || source.getName().startsWith("jai_imageio-4.4."))))
350350
{
351-
targetDirectory = new File(appDirectory, "jars/bio-formats");
351+
targetDirectory = new File(appDir, "jars/bio-formats");
352352
}
353353
else {
354-
targetDirectory = new File(appDirectory, "jars");
354+
targetDirectory = new File(appDir, "jars");
355355
}
356356
final String fileName = "Fiji_Updater".equals(artifact.getArtifactId())
357357
? artifact.getArtifactId() + ".jar" : source.getName();
358358
final File target = new File(targetDirectory, fileName);
359359

360360
boolean newerVersion = false;
361-
final Path directoryPath = Paths.get(appDirectory.toURI());
361+
final Path directoryPath = Paths.get(appDir.toURI());
362362
final Path targetPath = Paths.get(target.toURI());
363363
final Collection<Path> otherVersions = //
364364
getEncroachingVersions(directoryPath, targetPath);

src/main/java/org/scijava/maven/plugin/install/CopyJarsMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void execute() throws MojoExecutionException {
9999
"Property '" + APP_DIRECTORY_PROPERTY + "' unset; Skipping copy-jars");
100100
return;
101101
}
102-
final String interpolated = interpolate(appDirectory, project, session);
102+
final String interpolated = interpolate(appDirectory, project);
103103
appDir = new File(interpolated);
104104

105105
if (appSubdirectory == null) {

0 commit comments

Comments
 (0)