need a tool to compare java source files

A

alan jeeves

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.
 
M

Michael Borgwardt

alan said:
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.
 
M

Michael Borgwardt

alan said:
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.
 
T

Thomas Weidenfeller

alan said:
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
 
J

Jon A. Cruz

alan said:
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.
 
J

Jon A. Cruz

Thomas said:
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.
 
T

Thomas Weidenfeller

Jon said:
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
 
J

James D. Veale

alan jeeves said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top