Fork me on GitHub

CPD Results

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

Duplications

File Line
org/codehaus/mojo/javacc/JTBJavaCCMojo.java 312
org/codehaus/mojo/javacc/JTBMojo.java 264
deleteTempDirectory( tempDirectory );
    }

    /**
     * Gets the effective package name for the AST node files.
     * 
     * @return The effective package name for the AST node files, never <code>null</code>.
     */
    private String getNodePackageName()
    {
        if ( this.packageName != null )
        {
            return this.packageName + ".syntaxtree";
        }
        else if ( this.nodePackageName != null )
        {
            return this.nodePackageName;
        }
        else
        {
            return "*.syntaxtree";
        }
    }

    /**
     * Gets the effective package name for the visitor files.
     * 
     * @return The effective package name for the visitor files, never <code>null</code>.
     */
    private String getVisitorPackageName()
    {
        if ( this.packageName != null )
        {
            return this.packageName + ".visitor";
        }
        else if ( this.visitorPackageName != null )
        {
            return this.visitorPackageName;
        }
        else
        {
            return "*.visitor";
        }
    }

    /**
     * Creates a new facade to invoke JTB. Most options for the invocation are derived from the current values of the
     * corresponding mojo parameters. The caller is responsible to set the input file, output directories and packages
     * on the returned facade.
     * 
     * @return The facade for the tool invocation, never <code>null</code>.
     */
    private JTB newJTB()
    {
        JTB jtb = new JTB();
        jtb.setLog( getLog() );
        jtb.setDescriptiveFieldNames( this.descriptiveFieldNames );
        jtb.setJavadocFriendlyComments( this.javadocFriendlyComments );
        jtb.setNodeParentClass( this.nodeParentClass );
        jtb.setParentPointers( this.parentPointers );
        jtb.setPrinter( this.printer );
        jtb.setScheme( this.scheme );
        jtb.setSpecialTokens( this.specialTokens );
        jtb.setSupressErrorChecking( this.supressErrorChecking );
        return jtb;
    }

}
File Line
org/codehaus/mojo/javacc/JJTree.java 141
org/codehaus/mojo/javacc/JTB.java 132
public void setInputFile( File value )
    {
        if ( value != null && !value.isAbsolute() )
        {
            throw new IllegalArgumentException( "path is not absolute: " + value );
        }
        this.inputFile = value;
    }

    /**
     * Sets the absolute path to the output directory.
     * 
     * @param value The absolute path to the output directory for the generated grammar file. If this directory does not
     *            exist yet, it is created. Note that this path should already include the desired package hierarchy
     *            because JJTree will not append the required sub directories automatically.
     */
    public void setOutputDirectory( File value )
    {
        if ( value != null && !value.isAbsolute() )
        {
            throw new IllegalArgumentException( "path is not absolute: " + value );
        }
        this.outputDirectory = value;
    }

    /**
     * Gets the absolute path to the enhanced grammar file generated by JJTree.
     * 
     * @return The absolute path to the enhanced grammar file generated by JJTree or <code>null</code> if either the
     *         input file or the output directory have not been set.
     */
    public File getOutputFile()
    {
        File outputFile = null;
        if ( this.outputDirectory != null && this.inputFile != null )
        {
            String fileName = FileUtils.removeExtension( this.inputFile.getName() ) + ".jj";
            outputFile = new File( this.outputDirectory, fileName );
        }
        return outputFile;
    }

    /**
     * Sets the option GRAMMAR_ENCODING.
     * 
     * @param value The option value, may be <code>null</code> to use the value provided in the grammar or the default.
     */
    public void setGrammarEncoding( String value )
File Line
org/codehaus/mojo/javacc/JTBJavaCCMojo.java 42
org/codehaus/mojo/javacc/JTBMojo.java 43
{

    /**
     * This option is short for <code>nodePackageName</code> = <code>&lt;packageName&gt;.syntaxtree</code> and
     * <code>visitorPackageName</code> = <code>&lt;packageName&gt;.visitor</code>. Note that this option takes
     * precedence over <code>nodePackageName</code> and <code>visitorPackageName</code> if specified.
     *
     */
    @Parameter(property = "javacc.packageName")
    private String packageName;

    /**
     * This option specifies the package for the generated AST nodes. This value may use a leading asterisk to reference
     * the package of the corresponding parser. For example, if the parser package is <code>org.apache</code> and this
     * parameter is set to <code>*.demo</code>, the tree node classes will be located in the package
     * <code>org.apache.demo</code>. Default value is <code>*.syntaxtree</code>.
     *
     */
    @Parameter(property = "javacc.nodePackageName")
    private String nodePackageName;

    /**
     * This option specifies the package for the generated visitors. This value may use a leading asterisk to reference
     * the package of the corresponding parser. For example, if the parser package is <code>org.apache</code> and this
     * parameter is set to <code>*.demo</code>, the visitor classes will be located in the package
     * <code>org.apache.demo</code>. Default value is <code>*.visitor</code>.
     *
     */
    @Parameter(property = "javacc.visitorPackageName")
    private String visitorPackageName;

    /**
     * If <code>true</code>, JTB will suppress its semantic error checking. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.supressErrorChecking")
    private Boolean supressErrorChecking;

    /**
     * If <code>true</code>, all generated comments will be wrapped in <code>&lt;pre&gt;</code> tags so that they
     * are formatted correctly in API docs. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.javadocFriendlyComments")
    private Boolean javadocFriendlyComments;

    /**
     * Setting this option to <code>true</code> causes JTB to generate field names that reflect the structure of the
     * tree instead of generic names like <code>f0</code>, <code>f1</code> etc. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.descriptiveFieldNames")
    private Boolean descriptiveFieldNames;

    /**
     * The qualified name of a user-defined class from which all AST nodes will inherit. By default, AST nodes will
     * inherit from the generated class <code>Node</code>.
     *
     */
    @Parameter(property = "javacc.nodeParentClass")
    private String nodeParentClass;

    /**
     * If <code>true</code>, all nodes will contain fields for its parent node. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.parentPointers")
    private Boolean parentPointers;

    /**
     * If <code>true</code>, JTB will include JavaCC "special tokens" in the AST. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.specialTokens")
    private Boolean specialTokens;

    /**
     * If <code>true</code>, JTB will generate the following files to support the Schema programming language:
     * <ul>
     * <li>Scheme records representing the grammar.</li>
     * <li>A Scheme tree building visitor.</li>
     * </ul>
     * Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.scheme")
    private Boolean scheme;

    /**
     * If <code>true</code>, JTB will generate a syntax tree dumping visitor. Default value is <code>false</code>.
     *
     */
    @Parameter(property = "javacc.printer")
    private Boolean printer;

    /**
     * The directory where the JavaCC grammar files (<code>*.jtb</code>) are located. It will be recursively scanned
     * for input files to pass to JTB. The parameters <code>includes</code> and <code>excludes</code> can be used to
     * select a subset of files.
     *
     */
    @Parameter(property = "javacc.sourceDirectory", defaultValue = "${basedir}/src/main/jtb")
    private File sourceDirectory;

    /**
     * The directory where the visitor and AST node files generated by JTB will be stored. The directory will be
     * registered as a compile source root of the project such that the generated files will participate in later build
     * phases like compiling and packaging.
     *
     */
    @Parameter(property = "javacc.interimDirectory", defaultValue = "${project.build.directory}/generated-sources/jtb")
File Line
org/codehaus/mojo/javacc/JJTreeJavaCCMojo.java 346
org/codehaus/mojo/javacc/JJTreeMojo.java 325
jjtree.setStatic( getIsStatic() );
        jjtree.setBuildNodeFiles( this.buildNodeFiles );
        jjtree.setMulti( this.multi );
        jjtree.setNodeDefaultVoid( this.nodeDefaultVoid );
        jjtree.setNodeClass( this.nodeClass );
        jjtree.setNodeFactory( this.nodeFactory );
        jjtree.setNodePrefix( this.nodePrefix );
        jjtree.setNodeScopeHook( this.nodeScopeHook );
        jjtree.setNodeUsesParser( this.nodeUsesParser );
        jjtree.setTrackTokens( this.trackTokens );
        jjtree.setVisitor( this.visitor );
        jjtree.setVisitorDataType( this.visitorDataType );
        jjtree.setVisitorReturnType( this.visitorReturnType );
        jjtree.setVisitorException( this.visitorException );
        return jjtree;
    }