Hi,
I am a researcher in software reverse engineering.
During a case study
in which I analyzed jikes, I found several places in
jikes 1.22 where
fractions of code have been duplicated. I found
duplicates of
sequences of statements, whole functions, and even
whole classes (also
known as code clones). Redundancy makes changes more
difficult. An
error in the original fragment must be fixed in every
copy, but it is
rarely documented where code has been copied. My
suggestion is to
avoid redundant code. At any rate, one should be aware
of the
duplication when making changes.
Attached is a list of duplicated code in jikes 1.22
found by our
Bauhaus tools. I hope you find them useful.
The file format of the clone information is documented at
http://www.bauhaus-stuttgart.de/clones/. Basically, it
is a list of
pairs of clones. Every fragment is identified through
filename and
begin and end of line of the fragment. The last entry
in each row is
the type of clone. We distinguish:
1 - identical copy (only comments and layout may be
different
2 - structurally identical copy (syntactically the
same, identifiers,
operations, and literals may be different)
3 - similar fragments (copies with few changes)
Usually, type 1 and 2 are interesting findings.
There is also an emacs mode at
http://www.bauhaus-stuttgart.de/clones/cpf-mode.el that
allows one to
browse the list conveniently. The instructions on how
to install it
are included in cpf-mode.el.
After installation and restart of emacs, you can load the
clone file. You should start emacs in the src directory
of the jikes implementation.
Every file with suffix *.cpf will turn on the clone
mode. You can sort the entries by clone type (1,2,3)
by way of pressing C-c C-t.
If you press return on a line of clone pairs, the two
code fragments
will be shown aside of each other. The base path you
will be asked for
should be the src directory of the jikes implementation.
The attached archive contains two files:
jikes.cpf
jikes.functions.cpf
The latter contains cloned functions whereas the former
lists clone
pairs at the statement level.
I hope you find this information helpful to further
improve and
maintain jikes.
-- Rainer Koschke
gzipped tar archive that contains two files with code clones in jikes 1.22