need a tool to compare java source files

Discussion in 'Java' started by alan jeeves, Mar 3, 2004.

  1. alan jeeves

    alan jeeves Guest

    Hi,

    I need a tool to compare java source files - does any one know of any?

    It would be prefered if it does actually compare the code and not be based
    on just plain text - hope you know what i mean.

    Thanks,
    Alan.
     
    alan jeeves, Mar 3, 2004
    #1
    1. Advertisements

  2. alan jeeves wrote:
    > I need a tool to compare java source files - does any one know of any?
    >
    > It would be prefered if it does actually compare the code and not be based
    > on just plain text - hope you know what i mean.


    What kind of "comparison" do you want? Syntactical identity? In that case,
    a combination of a code formatter and a simple diff should do fine.

    If you meant semantical identity, I don't think that's feasible.
     
    Michael Borgwardt, Mar 3, 2004
    #2
    1. Advertisements

  3. alan jeeves

    alan jeeves Guest

    I'm managing to do it with a simple text comparsion app,

    but thanks


    "Michael Borgwardt" <> wrote in message
    news:c24lr5$1p0s87$-berlin.de...
    > alan jeeves wrote:
    > > I need a tool to compare java source files - does any one know of any?
    > >
    > > It would be prefered if it does actually compare the code and not be

    based
    > > on just plain text - hope you know what i mean.

    >
    > What kind of "comparison" do you want? Syntactical identity? In that case,
    > a combination of a code formatter and a simple diff should do fine.
    >
    > If you meant semantical identity, I don't think that's feasible.
    >
     
    alan jeeves, Mar 3, 2004
    #3
  4. alan jeeves wrote:

    > I'm managing to do it with a simple text comparsion app,


    That's what I meant with "simple diff". Combining it with a code
    formatter would offer the advantage of ignoring differences in
    formatting and whitespace. Beyond that, I don't see how any
    big improvement could be made.
     
    Michael Borgwardt, Mar 3, 2004
    #4
  5. alan jeeves

    Mickey Segal Guest

    "alan jeeves" <> wrote in message
    news:c24l2k$lhe$2surf.net...
    > I need a tool to compare java source files - does any one know of any?


    Microsoft's WinDiff.exe:
    http://www.tburke.net/info/suptools/topics/windiff.htm
    which came with Visual J++ 6.0 and various Windows support and resource
    kits, does such a comparison. If it is already on your computer it is worth
    trying.
     
    Mickey Segal, Mar 3, 2004
    #5
  6. alan jeeves wrote:
    > I need a tool to compare java source files - does any one know of any?


    Yes, I wrote a Unix diff clone in Java, just for fun. Of course, the
    real diff programs will do just fine, too.

    > It would be prefered if it does actually compare the code and not be based
    > on just plain text


    Nop. And definitely not my little diff (it can ignore whitespace, but
    that's it).

    If you can't find anything, I would suggest some pre-processing. Remove
    comments, all whitespace, etc.. Than run it through any diff command of
    your choice.

    /Thomas
     
    Thomas Weidenfeller, Mar 3, 2004
    #6
  7. alan jeeves

    Jon A. Cruz Guest

    alan jeeves wrote:
    > Hi,
    >
    > I need a tool to compare java source files - does any one know of any?
    >
    > It would be prefered if it does actually compare the code and not be based
    > on just plain text - hope you know what i mean.


    I usually use either tkdiff (with tkcvs) or Eclipse. The latter has a
    very niced styled diff viewer with sliding comparison areas like Sun's
    CM tool used to.
     
    Jon A. Cruz, Mar 3, 2004
    #7
  8. alan jeeves

    Jon A. Cruz Guest

    Thomas Weidenfeller wrote:
    > Nop. And definitely not my little diff (it can ignore whitespace, but
    > that's it).
    >
    > If you can't find anything, I would suggest some pre-processing. Remove
    > comments, all whitespace, etc.. Than run it through any diff command of
    > your choice.



    Try tkdiff (grab tkcvs) and give it the option to ignore whitespace
    (might be in the gui) -b

    And sometimes you want --ignore-all-space.
     
    Jon A. Cruz, Mar 4, 2004
    #8
  9. Jon A. Cruz wrote:
    > Try tkdiff (grab tkcvs) and give it the option to ignore whitespace
    > (might be in the gui) -b
    >
    > And sometimes you want --ignore-all-space.


    Space "folding" and completely ignoring spaces is implemented in my
    little diff (and all Unix diff versions I am aware of since Unix Version
    7). So any diff should be a good start. However, I assumed that this is
    not enough for the OP. For me it sounded he also wants to ignore
    comments and line breaks (anything ignored by the compiler, too). I
    don't know any tool which does this.

    /Thomas
     
    Thomas Weidenfeller, Mar 4, 2004
    #9
  10. Thought you might like to take a look here :)

    http://keithdevens.com/downloads/

    "alan jeeves" <> wrote in message news:<c24l2k$lhe$2surf.net>...
    > Hi,
    >
    > I need a tool to compare java source files - does any one know of any?
    >
    > It would be prefered if it does actually compare the code and not be based
    > on just plain text - hope you know what i mean.
    >
    > Thanks,
    > Alan.
     
    Krystan Honour, Mar 4, 2004
    #10
  11. "alan jeeves" <> writes:
    >I need a tool to compare java source files - does any one know of any?
    >It would be prefered if it does actually compare the code and not be based
    >on just plain text - hope you know what i mean.


    You may want to look at the Complite File Comparison Family at
    http://world.std.com/~jdveale

    These utilities perform a true word-by-word comparison where words
    may be separated not only by white-space but by common programming
    language delimiters. This avoids many issues with code formating.

    In addition the keyword processing capabilites can be configured
    to ignore most comments, or other application specific requirements.

    Demonstration versions and contact information is on the web page.

    Jim Veale
     
    James D. Veale, Mar 5, 2004
    #11
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    java source diff tool?

    Alex Hunsley, Jun 23, 2004, in forum: Java
    Replies:
    12
    Views:
    1,572
    Roedy Green
    Jun 25, 2004
  2. writeOnceDebugEverywhere()

    Open-source tool which generates Java Value objects ?

    writeOnceDebugEverywhere(), Mar 23, 2005, in forum: Java
    Replies:
    5
    Views:
    853
    frebe
    Mar 23, 2005
  3. Diomidis Spinellis

    Open source Java metrics tool

    Diomidis Spinellis, Apr 14, 2006, in forum: Java
    Replies:
    0
    Views:
    1,097
    Diomidis Spinellis
    Apr 14, 2006
  4. Frank
    Replies:
    1
    Views:
    914
    Dimitre Novatchev
    Sep 12, 2003
  5. Replies:
    0
    Views:
    529
  6. Raymond Schanks
    Replies:
    1
    Views:
    480
  7. Steve Mauldin
    Replies:
    0
    Views:
    246
    Steve Mauldin
    Feb 6, 2004
  8. Sourabh Mhaisekar

    Need Open Source Mock Up/ Designing Tool

    Sourabh Mhaisekar, May 9, 2013, in forum: Java
    Replies:
    2
    Views:
    395
    Arne Vajhøj
    May 10, 2013
Loading...