持续专业进修结果
以下文档包含 PMD 的 CPD 5.6.1 的结果。
重复
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\maven30\VerboseJavaScopeSelector.java |
34 |
org\apache\maven\shared\dependency\graph\internal\maven31\VerboseJavaScopeSelector.java |
35 |
public class VerboseJavaScopeSelector extends ScopeSelector
{
public static final String REDUCED_SCOPE = "REDUCED_SCOPE";
private final ScopeSelector scopeSelector = new JavaScopeSelector();
@Override
public void selectScope( ConflictContext context )
throws RepositoryException
{
scopeSelector.selectScope( context );
context.getItems().stream()
.flatMap( i -> i.getScopes().stream() )
.distinct()
.max( new ScopeComparator() )
.filter( s -> s != context.getScope() )
.ifPresent( s -> context.getWinner().getNode().setData( REDUCED_SCOPE, s ) );
}
static class ScopeComparator implements Comparator<String>
{
List<String> orderedScopes = Arrays.asList( "compile", "runtime", "provided", "test" );
@Override
public int compare( String lhs, String rhs )
{
return orderedScopes.indexOf( rhs ) - orderedScopes.indexOf( lhs );
}
}
} |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyCollectorBuilder.java |
257 |
org\apache\maven\shared\dependency\graph\internal\Maven3DependencyCollectorBuilder.java |
263 |
String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
Boolean optional = null;
if ( node.getDependency() != null )
{
optional = node.getDependency().isOptional();
}
List<org.apache.maven.model.Exclusion> exclusions = null;
if ( node.getDependency() != null )
{
exclusions = new ArrayList<>( node.getDependency().getExclusions().size() );
for ( Exclusion exclusion : node.getDependency().getExclusions() )
{
org.apache.maven.model.Exclusion modelExclusion = new org.apache.maven.model.Exclusion();
modelExclusion.setGroupId( exclusion.getGroupId() );
modelExclusion.setArtifactId( exclusion.getArtifactId() );
exclusions.add( modelExclusion );
}
}
org.eclipse.aether.graph.DependencyNode winner = |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyCollectorBuilder.java |
296 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyGraphBuilder.java |
187 |
exclusions, data );
List<DependencyNode> nodes = new ArrayList<DependencyNode>( node.getChildren().size() );
for ( org.eclipse.aether.graph.DependencyNode child : node.getChildren() )
{
Artifact childArtifact = getDependencyArtifact( child.getDependency() );
if ( ( filter == null ) || filter.include( childArtifact ) )
{
nodes.add( buildDependencyNode( current, child, childArtifact, filter ) );
}
}
current.setChildren( Collections.unmodifiableList( nodes ) );
return current;
}
private String getVersionSelectedFromRange( VersionConstraint constraint )
{
if ( ( constraint == null ) || ( constraint.getVersion() != null ) )
{
return null;
}
return constraint.getRange().toString();
}
} |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\Maven3DependencyCollectorBuilder.java |
302 |
org\apache\maven\shared\dependency\graph\internal\Maven3DependencyGraphBuilder.java |
126 |
data );
List<DependencyNode> nodes = new ArrayList<DependencyNode>( node.getChildren().size() );
for ( org.sonatype.aether.graph.DependencyNode child : node.getChildren() )
{
Artifact childArtifact = getDependencyArtifact( child.getDependency() );
if ( ( filter == null ) || filter.include( childArtifact ) )
{
nodes.add( buildDependencyNode( current, child, childArtifact, filter ) );
}
}
current.setChildren( Collections.unmodifiableList( nodes ) );
return current;
}
private String getVersionSelectedFromRange( VersionConstraint constraint )
{
if ( ( constraint == null ) || ( constraint.getVersion() != null ) || ( constraint.getRanges().isEmpty() ) ) |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyCollectorBuilder.java |
299 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyGraphBuilder.java |
190 |
org\apache\maven\shared\dependency\graph\internal\Maven3DependencyGraphBuilder.java |
129 |
for ( org.eclipse.aether.graph.DependencyNode child : node.getChildren() )
{
Artifact childArtifact = getDependencyArtifact( child.getDependency() );
if ( ( filter == null ) || filter.include( childArtifact ) )
{
nodes.add( buildDependencyNode( current, child, childArtifact, filter ) );
}
}
current.setChildren( Collections.unmodifiableList( nodes ) );
return current;
}
private String getVersionSelectedFromRange( VersionConstraint constraint )
{
if ( ( constraint == null ) || ( constraint.getVersion() != null ) )
{
return null;
} |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\maven30\Maven3DirectScopeDependencySelector.java |
85 |
org\apache\maven\shared\dependency\graph\internal\maven31\Maven31DirectScopeDependencySelector.java |
85 |
return new Maven3DirectScopeDependencySelector( scope, depth + 1 );
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + depth;
result = prime * result + ( ( scope == null ) ? 0 : scope.hashCode() );
return result;
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
{
return true;
}
if ( obj == null )
{
return false;
}
if ( getClass() != obj.getClass() )
{
return false;
} |
文件 |
线 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyCollectorBuilder.java |
265 |
org\apache\maven\shared\dependency\graph\internal\Maven31DependencyGraphBuilder.java |
171 |
org\apache\maven\shared\dependency\graph\internal\Maven3DependencyCollectorBuilder.java |
271 |
List<org.apache.maven.model.Exclusion> exclusions = null;
if ( node.getDependency() != null )
{
exclusions = new ArrayList<>( node.getDependency().getExclusions().size() );
for ( Exclusion exclusion : node.getDependency().getExclusions() )
{
org.apache.maven.model.Exclusion modelExclusion = new org.apache.maven.model.Exclusion();
modelExclusion.setGroupId( exclusion.getGroupId() );
modelExclusion.setArtifactId( exclusion.getArtifactId() );
exclusions.add( modelExclusion );
}
} |