CPD Results

The following document contains the results of PMD's CPD 5.6.1.

Duplications

File Line
org\eclipse\aether\util\graph\manager\ClassicDependencyManager.java 180
org\eclipse\aether\util\graph\manager\TransitiveDependencyManager.java 174
                management.setVersion( version );
            }

            String scope = managedScopes.get( key );
            if ( scope != null )
            {
                if ( management == null )
                {
                    management = new DependencyManagement();
                }
                management.setScope( scope );

                if ( !JavaScopes.SYSTEM.equals( scope )
                    && dependency.getArtifact().getProperty( ArtifactProperties.LOCAL_PATH, null ) != null )
                {
                    Map<String, String> properties =
                        new HashMap<>( dependency.getArtifact().getProperties() );
                    properties.remove( ArtifactProperties.LOCAL_PATH );
                    management.setProperties( properties );
                }
            }

            if ( ( JavaScopes.SYSTEM.equals( scope ) )
                || ( scope == null && JavaScopes.SYSTEM.equals( dependency.getScope() ) ) )
            {
                String localPath = managedLocalPaths.get( key );
                if ( localPath != null )
                {
                    if ( management == null )
                    {
                        management = new DependencyManagement();
                    }
                    Map<String, String> properties =
                        new HashMap<>( dependency.getArtifact().getProperties() );
                    properties.put( ArtifactProperties.LOCAL_PATH, localPath );
                    management.setProperties( properties );
                }
            }

            Boolean optional = managedOptionals.get( key );
            if ( optional != null )
            {
                if ( management == null )
                {
                    management = new DependencyManagement();
                }
                management.setOptional( optional );
            }
        }

        Collection<Exclusion> exclusions = managedExclusions.get( key );
        if ( exclusions != null )
        {
            if ( management == null )
            {
                management = new DependencyManagement();
            }
            Collection<Exclusion> result = new LinkedHashSet<>( dependency.getExclusions() );
            result.addAll( exclusions );
            management.setExclusions( result );
        }

        return management;
    }

    private Object getKey( Artifact a )
    {
        return new Key( a );
    }

    @Override
    public boolean equals( Object obj )
File Line
org\eclipse\aether\util\graph\manager\DefaultDependencyManager.java 269
org\eclipse\aether\util\graph\manager\TransitiveDependencyManager.java 265
            hashCode = Objects.hash( managedVersions, managedScopes, managedOptionals, managedExclusions );
        }
        return hashCode;
    }

    static class Key
    {

        private final Artifact artifact;

        private final int hashCode;

        Key( final Artifact artifact )
        {
            this.artifact = artifact;
            this.hashCode = Objects.hash( artifact.getGroupId(), artifact.getArtifactId() );
        }

        @Override
        public boolean equals( final Object obj )
        {
            boolean equal = obj instanceof Key;

            if ( equal )
            {
                final Key that = (Key) obj;
                return Objects.equals( artifact.getArtifactId(), that.artifact.getArtifactId() )
                           && Objects.equals( artifact.getGroupId(), that.artifact.getGroupId() )
                           && Objects.equals( artifact.getExtension(), that.artifact.getExtension() )
                           && Objects.equals( artifact.getClassifier(), that.artifact.getClassifier() );

            }

            return equal;
        }

        @Override
        public int hashCode()
        {
            return this.hashCode;
        }

    }

}
File Line
org\eclipse\aether\util\graph\manager\ClassicDependencyManager.java 173
org\eclipse\aether\util\graph\manager\DefaultDependencyManager.java 167
            String version = managedVersions.get( key );
            if ( version != null )
            {
                if ( management == null )
                {
                    management = new DependencyManagement();
                }
                management.setVersion( version );
            }

            String scope = managedScopes.get( key );
            if ( scope != null )
            {
                if ( management == null )
                {
                    management = new DependencyManagement();
                }
                management.setScope( scope );

                if ( !JavaScopes.SYSTEM.equals( scope )
                    && dependency.getArtifact().getProperty( ArtifactProperties.LOCAL_PATH, null ) != null )
                {
                    Map<String, String> properties =
                        new HashMap<>( dependency.getArtifact().getProperties() );
                    properties.remove( ArtifactProperties.LOCAL_PATH );
                    management.setProperties( properties );
                }
            }

            if ( ( JavaScopes.SYSTEM.equals( scope ) )
File Line
org\eclipse\aether\util\graph\manager\ClassicDependencyManager.java 202
org\eclipse\aether\util\graph\manager\DefaultDependencyManager.java 197
org\eclipse\aether\util\graph\manager\TransitiveDependencyManager.java 195
            if ( ( JavaScopes.SYSTEM.equals( scope ) )
                || ( scope == null && JavaScopes.SYSTEM.equals( dependency.getScope() ) ) )
            {
                String localPath = managedLocalPaths.get( key );
                if ( localPath != null )
                {
                    if ( management == null )
                    {
                        management = new DependencyManagement();
                    }
                    Map<String, String> properties =
                        new HashMap<>( dependency.getArtifact().getProperties() );
                    properties.put( ArtifactProperties.LOCAL_PATH, localPath );
                    management.setProperties( properties );
                }
            }

            Boolean optional = managedOptionals.get( key );
            if ( optional != null )
            {
                if ( management == null )
                {
                    management = new DependencyManagement();
                }
                management.setOptional( optional );
            }
File Line
org\eclipse\aether\util\artifact\ArtifactIdUtils.java 164
org\eclipse\aether\util\artifact\ArtifactIdUtils.java 202
    public static boolean equalsId( Artifact artifact1, Artifact artifact2 )
    {
        if ( artifact1 == null || artifact2 == null )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getArtifactId(), artifact2.getArtifactId() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getGroupId(), artifact2.getGroupId() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getExtension(), artifact2.getExtension() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getClassifier(), artifact2.getClassifier() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getVersion(), artifact2.getVersion() ) )
File Line
org\eclipse\aether\util\graph\manager\ClassicDependencyManager.java 299
org\eclipse\aether\util\graph\transformer\ConflictMarker.java 275
        }

        @Override
        public boolean equals( Object obj )
        {
            if ( obj == this )
            {
                return true;
            }
            else if ( !( obj instanceof Key ) )
            {
                return false;
            }
            Key that = (Key) obj;
            return artifact.getArtifactId().equals( that.artifact.getArtifactId() )
                && artifact.getGroupId().equals( that.artifact.getGroupId() )
                && artifact.getExtension().equals( that.artifact.getExtension() )
                && artifact.getClassifier().equals( that.artifact.getClassifier() );
        }

        @Override
        public int hashCode()
        {
File Line
org\eclipse\aether\util\artifact\ArtifactIdUtils.java 164
org\eclipse\aether\util\artifact\ArtifactIdUtils.java 202
org\eclipse\aether\util\artifact\ArtifactIdUtils.java 241
    public static boolean equalsId( Artifact artifact1, Artifact artifact2 )
    {
        if ( artifact1 == null || artifact2 == null )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getArtifactId(), artifact2.getArtifactId() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getGroupId(), artifact2.getGroupId() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getExtension(), artifact2.getExtension() ) )
        {
            return false;
        }
        if ( !Objects.equals( artifact1.getClassifier(), artifact2.getClassifier() ) )
        {
            return false;
        }
File Line
org\eclipse\aether\util\graph\manager\DefaultDependencyManager.java 174
org\eclipse\aether\util\graph\manager\TransitiveDependencyManager.java 174
            management.setVersion( version );
        }

        String scope = managedScopes.get( key );
        if ( scope != null )
        {
            if ( management == null )
            {
                management = new DependencyManagement();
            }
            management.setScope( scope );

            if ( !JavaScopes.SYSTEM.equals( scope )
                     && dependency.getArtifact().getProperty( ArtifactProperties.LOCAL_PATH, null ) != null )
            {
                Map<String, String> properties =
                    new HashMap<>( dependency.getArtifact().getProperties() );

                properties.remove( ArtifactProperties.LOCAL_PATH );
                management.setProperties( properties );
            }
        }

        if ( ( scope != null && JavaScopes.SYSTEM.equals( scope ) )