Alex said:
Does anyone know what is @(#) in the beginning of each jdk source file?
How is it used? Is it a javadoc tag?
Oh you are a young grasshopper. This is the SCCS marker string intended
for the 'what' program.
SCCS (Source Code Control System) is an a age-old version control
system. In fact, it is the original UNIX version control system (long
ago most people dropped it for the free RCS version control system,
which people later often dropped for the free CVS version control
system, which in turn is about to be dropped by people for the
Subversion version control system ...)
The idea is to have a marker in a file (source or binary) which can
easily be distinguished from other data. The 'what' program simply looks
for text of the form '@(#) ... \0' in all kinds of files, and prints the
text.
If one combines this with SCCS' ability to expand keywords during
checkout, you can get automatically correctly labeled source code. If
you compile the data into a binary, you can trace the binary back to the
source from which it was build.
This works better in C than in Java. If you write something like
char sccsid[] = "@(#)text";
in C it ends up as the correct byte sequence in the binary (the trailing
'\0' is implicit in C strings. but in Java it isn't, and you can't just
insert an own \0 in the string. Well, you can, but Java encodes the \0
not as a 00, but as C0 80 (which is not well formed UTF-8, but common).
. If you do the equivalent in java
String sccsid = "@(#)text";
you have to find a way to get the \0 into that string. This is left as
an exercise to the reader.
The real question is why Sun still uses the age old SCCS. Well, AFAIK it
is still the base for Sun's Teamware / Forte Code Management Software
version control system. Also AFAIK Teamware is not a big player in the
commercial version control software market.
/Thomas