Skip to content

Commit

Permalink
[FELIX-6075] Upgrade to JDK 8
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1854548 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
gnodet committed Feb 28, 2019
1 parent e971b02 commit 4857cb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;

import org.apache.maven.artifact.Artifact;
Expand Down Expand Up @@ -91,13 +90,13 @@ public void processHeaders( Analyzer analyzer ) throws MojoExecutionException

processInstructions( embedDependencyHeader );

for ( Iterator<String> i = m_inlinedPaths.iterator(); i.hasNext(); )
for ( String path : m_inlinedPaths )
{
inlineDependency( i.next(), includeResource );
inlineDependency( path, includeResource );
}
for ( Iterator<Artifact> i = m_embeddedArtifacts.iterator(); i.hasNext(); )
for ( Artifact artifact : m_embeddedArtifacts )
{
embedDependency( i.next(), includeResource, bundleClassPath, embeddedArtifacts );
embedDependency( artifact, includeResource, bundleClassPath, embeddedArtifacts );
}
}

Expand Down Expand Up @@ -125,9 +124,9 @@ protected void processDependencies( Collection<Artifact> dependencies, String in
}
else
{
for ( Iterator<Artifact> i = dependencies.iterator(); i.hasNext(); )
for ( Artifact dependency : dependencies )
{
addInlinedPaths( i.next(), inline, m_inlinedPaths );
addInlinedPaths( dependency, inline, m_inlinedPaths );
}
}
}
Expand All @@ -145,11 +144,11 @@ private static void addInlinedPaths( Artifact dependency, String inline, Collect
else
{
String[] filters = inline.split( "\\|" );
for ( int i = 0; i < filters.length; i++ )
for ( String filter : filters )
{
if ( filters[i].length() > 0 )
if ( filter.length() > 0 )
{
inlinedPaths.add( path + "!/" + filters[i] );
inlinedPaths.add( path + "!/" + filter );
}
}
}
Expand All @@ -169,14 +168,14 @@ private void embedDependency( Artifact dependency, StringBuffer includeResource,
embedDirectory = null;
}

if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() )
if ( !Boolean.valueOf( m_embedStripGroup ) )
{
embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath();
}

StringBuffer targetFileName = new StringBuffer();
StringBuilder targetFileName = new StringBuilder();
targetFileName.append( dependency.getArtifactId() );
if ( false == Boolean.valueOf( m_embedStripVersion ).booleanValue() )
if ( !Boolean.valueOf( m_embedStripVersion ) )
{
targetFileName.append( '-' ).append( dependency.getVersion() );
if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
Expand Down Expand Up @@ -265,7 +264,7 @@ private static void appendDependencies( Analyzer analyzer, String directiveName,
final String instruction = analyzer.getProperty( directiveName );
if ( StringUtils.isNotEmpty( instruction ) )
{
if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 )
if ( instruction.contains( MAVEN_DEPENDENCIES ) )
{
// if there are no embeddded dependencies, we do a special treatment and replace
// every occurance of MAVEN_DEPENDENCIES and a following comma with an empty string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
/**
* Fixed version of class that uses stable set ordering for reliable testing.
*/
@SuppressWarnings( { "rawtypes", "unchecked" } )
class ArtifactStubFactory extends org.apache.maven.plugin.testing.ArtifactStubFactory
{

Expand All @@ -39,9 +38,9 @@ public ArtifactStubFactory( File workingDir, boolean createFiles )
}

@Override
public Set getClassifiedArtifacts() throws IOException
public Set<Artifact> getClassifiedArtifacts() throws IOException
{
Set set = new LinkedHashSet();
Set<Artifact> set = new LinkedHashSet<>();
set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) );
set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) );
set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) );
Expand All @@ -50,9 +49,9 @@ public Set getClassifiedArtifacts() throws IOException
}

@Override
public Set getScopedArtifacts() throws IOException
public Set<Artifact> getScopedArtifacts() throws IOException
{
Set set = new LinkedHashSet();
Set<Artifact> set = new LinkedHashSet<>();
set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) );
set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) );
set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) );
Expand All @@ -62,9 +61,9 @@ public Set getScopedArtifacts() throws IOException
}

@Override
public Set getTypedArtifacts() throws IOException
public Set<Artifact> getTypedArtifacts() throws IOException
{
Set set = new LinkedHashSet();
Set<Artifact> set = new LinkedHashSet<>();
set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) );
Expand Down

0 comments on commit 4857cb9

Please sign in to comment.