Skip to content

Commit 716c63d

Browse files
committed
Fix Eclipse warnings
1 parent ad31dd1 commit 716c63d

File tree

6 files changed

+28
-25
lines changed

6 files changed

+28
-25
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@
235235
<plugin>
236236
<groupId>org.apache.maven.plugins</groupId>
237237
<artifactId>maven-plugin-plugin</artifactId>
238-
<version>3.3</version>
239238
<configuration>
240239
<!-- see https://issues.apache.org/jira/browse/MNG-5346 -->
241240
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ private void makeImageJRepositoryKnown() throws MojoExecutionException
156156
if (IMAGEJ_REPOSITORY_URL.equals(url)) return;
157157
}
158158

159-
final ArtifactRepositoryLayout layout =
160-
(ArtifactRepositoryLayout) repositoryLayouts.get("default");
159+
final ArtifactRepositoryLayout layout = repositoryLayouts.get("default");
161160

162161
if (layout == null) {
163162
throw new MojoExecutionException("default", "Invalid repository layout",

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

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

7878
getLog().info("Parsing SciJava annotations");
7979
try {
80+
@SuppressWarnings("unchecked")
8081
final List<String> elements = currentProject.getCompileClasspathElements();
8182
final URL[] classpath = new URL[elements.size() + 1];
8283
classpath[0] = buildDirectory.toURI().toURL();
@@ -126,6 +127,7 @@ public void execute() throws MojoExecutionException {
126127
* @return true iff the project depends on <code>scijava-common</code>
127128
*/
128129
private boolean dependsOnScijavaCommon(final MavenProject project) {
130+
@SuppressWarnings("unchecked")
129131
final List<Dependency> dependencies = project.getCompileDependencies();
130132
if (dependencies == null) return false;
131133

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ public abstract class AbstractResolveDependencies implements EnforcerRule
5858

5959
private transient List<ArtifactRepository> remoteRepositories;
6060

61-
private transient EnforcerRuleHelper helper;
61+
private transient EnforcerRuleHelper ruleHelper;
62+
63+
@Override
6264
public void execute( EnforcerRuleHelper helper )
6365
throws EnforcerRuleException
6466
{
65-
this.helper = helper;
67+
ruleHelper = helper;
6668

6769
// Get components
6870
try
@@ -84,7 +86,9 @@ public void execute( EnforcerRuleHelper helper )
8486

8587
localRepository = (ArtifactRepository) helper.evaluate( "${localRepository}" );
8688

87-
remoteRepositories = (List<ArtifactRepository>) helper.evaluate( "${project.remoteArtifactRepositories}" );
89+
@SuppressWarnings("unchecked")
90+
final List<ArtifactRepository> result = (List<ArtifactRepository>) helper.evaluate( "${project.remoteArtifactRepositories}" );
91+
remoteRepositories = result;
8892
}
8993
catch ( ExpressionEvaluationException e )
9094
{
@@ -103,12 +107,12 @@ protected boolean isSearchTransitive()
103107
return true;
104108
}
105109

106-
private Set<Artifact> getDependenciesToCheck( MavenProject project, ArtifactRepository localRepository )
110+
private Set<Artifact> getDependenciesToCheck( MavenProject project, ArtifactRepository repository )
107111
{
108112
Set<Artifact> dependencies = null;
109113
try
110114
{
111-
DependencyNode node = treeBuilder.buildDependencyTree( project, localRepository, null );
115+
DependencyNode node = treeBuilder.buildDependencyTree( project, repository, null );
112116

113117
if( isSearchTransitive() )
114118
{
@@ -171,28 +175,22 @@ private Set<Artifact> getAllDescendants( DependencyNode node )
171175

172176
protected Log getLog()
173177
{
174-
return helper.getLog();
178+
return ruleHelper.getLog();
175179
}
176180

177-
/**
178-
* {@inheritDoc}
179-
*/
181+
@Override
180182
public boolean isCacheable()
181183
{
182184
return false;
183185
}
184186

185-
/**
186-
* {@inheritDoc}
187-
*/
187+
@Override
188188
public boolean isResultValid( EnforcerRule enforcerRule )
189189
{
190190
return false;
191191
}
192192

193-
/**
194-
* {@inheritDoc}
195-
*/
193+
@Override
196194
public String getCacheId()
197195
{
198196
return "Does not matter as not cacheable";
@@ -232,6 +230,8 @@ protected static String asRegex(String wildcard)
232230
case '|':
233231
case '}':
234232
result.append( "\\" );
233+
result.append( character );
234+
break;
235235
default:
236236
result.append( character );
237237
break;
@@ -251,7 +251,7 @@ protected class IgnorableDependency
251251
public Pattern artifactId;
252252
public Pattern classifier;
253253
public Pattern type;
254-
public List<Pattern> ignores = new ArrayList<Pattern>();
254+
public List<Pattern> ignorePatterns = new ArrayList<Pattern>();
255255

256256
public IgnorableDependency applyIgnoreClasses( String[] ignores, boolean indent )
257257
{
@@ -262,7 +262,7 @@ public IgnorableDependency applyIgnoreClasses( String[] ignores, boolean indent
262262
ignore = ignore.replace( '.', '/' );
263263
String pattern = asRegex( ignore );
264264
getLog().debug( prefix + "Ignore: " + ignore + " maps to regex " + pattern );
265-
this.ignores.add( Pattern.compile( pattern ) );
265+
ignorePatterns.add( Pattern.compile( pattern ) );
266266
}
267267
return this;
268268
}
@@ -277,7 +277,7 @@ public boolean matchesArtifact( Artifact dup )
277277

278278
public boolean matches(String className)
279279
{
280-
for ( Pattern p : ignores )
280+
for ( Pattern p : ignorePatterns )
281281
{
282282
if ( p.matcher( className ).matches() )
283283
{

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ else if ( file.isDirectory() )
126126
{
127127
try
128128
{
129-
for ( String name : (List<String>) FileUtils.getFileNames( file, null, null, false ) )
129+
@SuppressWarnings("unchecked")
130+
final List<String> fileNames = FileUtils.getFileNames( file, null, null, false );
131+
for ( String name : fileNames )
130132
{
131133
getLog().debug( " " + name );
132134
checkAndAddName( o, name, classNames, duplicates, ignorableDependencies );

src/main/java/org/scijava/maven/plugin/util/PomEditor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ public class PomEditor {
6464
private XPath xpath;
6565

6666
/**
67-
* Parses the specified <tt>pom.xml</tt> file.
67+
* Parses the specified <tt>pom.xml</tt> stream.
6868
*
69-
* @param file the <tt>pom.xml</tt> file
69+
* @param inputStream the <tt>pom.xml</tt> data
70+
* @param log object to use for logging messages
7071
* @throws ParserConfigurationException
7172
* @throws SAXException
7273
* @throws IOException
@@ -87,7 +88,7 @@ public PomEditor(final InputStream inputStream, final Log log) throws ParserConf
8788
/**
8889
* Writes out the modified <tt>pom.xml</tt>
8990
*
90-
* @param file the <tt>pom.xml</tt> file
91+
* @param writer object for writing the <tt>pom.xml</tt> file
9192
* @throws DOMException
9293
* @throws IOException
9394
*/

0 commit comments

Comments
 (0)