CPD Results

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

Duplications

File Line
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 946
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 993
        sc = jMethod.getSourceCode();
        sc.add( "if ( source == null )" );
        sc.add( "{" );
        sc.addIndented( "return target;" );
        sc.add( "}" );
        sc.add( "else if ( target == null )" );
        sc.add( "{" );
        sc.addIndented( "return source;" );
        sc.add( "}" );
        sc.add( "" );
        sc.add( locationClass.getName() + " result =" );
        sc.add( "    new " + locationClass.getName() + "( target.getLineNumber(), target.getColumnNumber()" + (
            sourceClass != null
                ? ", target.get" + capitalise( source.getName() ) + "()"
                : "" ) + " );" );
        sc.add( "" );
        sc.add( fieldType + " locations;" );
        sc.add( fieldType + " sourceLocations = source.get" + capitalise( locationsField ) + "();" );
        sc.add( fieldType + " targetLocations = target.get" + capitalise( locationsField ) + "();" );
        sc.add( "if ( sourceLocations == null )" );
        sc.add( "{" );
        sc.addIndented( "locations = targetLocations;" );
        sc.add( "}" );
        sc.add( "else if ( targetLocations == null )" );
        sc.add( "{" );
        sc.addIndented( "locations = sourceLocations;" );
        sc.add( "}" );
        sc.add( "else" );
        sc.add( "{" );
        sc.addIndented( "locations = new " + fieldImpl.getName() + "();" );
File Line
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 1426
org/codehaus/modello/plugin/java/JavaModelloGenerator.java 2154
        JavaAssociationMetadata javaAssociationMetadata = getJavaAssociationMetadata( modelAssociation );

        if ( modelAssociation.isManyMultiplicity() )
        {
            JType componentType = getComponentType( modelAssociation, javaAssociationMetadata );

            String defaultValue = getDefaultValue( modelAssociation, componentType );

            JType type;
            if ( modelAssociation.isGenericType() )
            {
                type = new JCollectionType( modelAssociation.getType(), componentType, useJava5 );
            }
            else if ( ModelDefault.MAP.equals( modelAssociation.getType() ) )
            {
                JMapType mapType = new JMapType( modelAssociation.getType(), defaultValue, componentType, useJava5 );
                defaultValue = mapType.getInstanceName();
                type = mapType;
            }
            else
            {
                type = new JClass( modelAssociation.getType() );
            }

            JField jField = new JField( type, modelAssociation.getName() );
File Line
org/codehaus/modello/plugin/java/javasource/JClass.java 686
org/codehaus/modello/plugin/java/javasource/JInterface.java 456
            if ( fieldAnnotations != null ) fieldAnnotations.print( jsw );

            // -- print member
            jsw.write( jField.getModifiers().toString() );
            jsw.write( ' ' );

            JType type = jField.getType();
            String typeName = type.toString();
            //-- for esthetics use short name in some cases
            if ( typeName.equals( toString() ) )
            {
                typeName = type.getLocalName();
            }
            jsw.write( typeName );
            jsw.write( ' ' );
            jsw.write( jField.getName() );

            String init = jField.getInitString();
            if ( init != null )
            {
                jsw.write( " = " );
                jsw.write( init );
            }

            jsw.writeln( ';' );
            jsw.writeln();
        }
File Line
org/codehaus/modello/plugin/java/javasource/JCompUnit.java 292
org/codehaus/modello/plugin/java/javasource/JStructure.java 378
        String javaPackagePath = "";
        if ( ( packageName != null ) && ( packageName.length() > 0 ) )
        {
            javaPackagePath = packageName.replace( '.', File.separatorChar );
        }

        //-- Create fully qualified path (including 'destDir') to file
        File pathFile;
        if ( destDir == null )
            pathFile = new File( javaPackagePath );
        else
            pathFile = new File( destDir, javaPackagePath );
        if ( !pathFile.exists() )
        {
            pathFile.mkdirs();
        }

        //-- Prefix filename with path
        if ( pathFile.toString().length() > 0 )
            filename = pathFile.toString() + File.separator + filename;

        return filename;
    } //-- getFilename

    /**
     * Returns the name of the package that this JCompUnit is a member of
     * @return the name of the package that this JCompUnit is a member of,
     * or null if there is no current package name defined
     **/
    public String getPackageName()