incava.org

Name

diffj — compares Java files

Synopsis

diffj [--brief] [[--recurse] | [-r]] [--source =VERSION ] [--from-source =VERSION ] [--to-source =VERSION ] [--version] [--verbose] { from } { to }

Description

diffj is an application that compares Java files and projects. It operates similarly to diff(1), but compares only Java tokens and types, and skips whitespace and comments.

Options

--brief

Whether to list differences in long form (the default) or in terse format. The long form resembles output from diff(1), and the brief form lists only the locations and summary of what changed, but not the changes themselves, such as:

    org/incava/util/TimedEvent.java <=> ../doctorj/org/incava/util/TimedEvent.java
    4a4: import added: org.incava.log.Log
    4d4: import removed: org.incava.qualog.QLog
    27c27,29: code changed
    28c30: code changed

By default, violations are displayed in “long form”, showing the context.

--recurse -r

Sets processing recursively. This option presumes that the final two arguments are directories. Each .java file in each directory will be compared to the equivalently-named file in the other directory hierarchy.

--source =VERSION

Sets the source version of both the from and the to files. The version is for determining the grammar with which to parse the input files. VERSION may be 1.3, 1.4 or 1.5. The default is 1.5.

--from-source =VERSION

Sets the source version of the from (left-hand side) files.

--to-source =VERSION

Sets the source version of the to (right-hand side) files.

--verbose

Produces debugging output. Note that this signficantly impedes performance.

--version

Displays the version, and exits.

from to

Specifies the files or directories to check. If both from and to are directories, then all files ending in “.java” under those directories will be analyzed. If one is a file and the other is a directory, then the equivalently-named file would be sought.

Examples

To compare two files:

% diffj String.java lang/String.java

Equivalently, assuming that String.java exists in lang:

% diffj String.java lang

To compare all files in two directories:

% diffj app-old app-new

To compare all files in two directory hierarchies:

% diffj --recurse app-old app-new

To compare Java 1.3 code:

% diffj --source=1.3 app-old app-new

To compare Java 1.5 code:

% diffj --source=1.5 app-old app-new

To compare Java 1.3 against 1.4 code:

% diffj --from-source=1.3 app-old app-new

To compare Java 1.4 against 1.5 code:

% diffj --to-source=1.5 app-old app-new

To compare Java 1.3 against 1.5 code:

% diffj --to-source=1.3 --to-source=1.5 app-old app-new

Configuration

$HOME/.diffjrc

The run-control file, of the form:

    source: 1.4
    verbose: false
         

Author

Jeff Pace .

The DiffJ web site is at http://www.incava.org/projects/java/diffj.

Bugs

Bugs and issues should be emailed to the author: Jeff Pace

See Also

diff(1)

Copyright

Copyright (c) 2005-2007, Jeff Pace.

All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Lesser GNU Public License

Valid HTML 4.01!

Valid CSS!