Re: How Javac works



Roedy Green wrote:
On Sat, 16 Jul 2005 02:49:01 GMT, Dale King
<DaleWKing@xxxxxxxxxxxxxxxxxxxx> wrote or quoted :


That doesn't mean everything is rebuilt. Consider if I have three java files so that A depends on B and B depends on C. If A and C are out of date but B is not and you compile A.java then C will not get rebuilt. If B were out of date then all three would be compiled.


there are two reasons for a class file to be out of date:

obvious -- its date is not after the source file date.

I really wish the world would move beyond this fantasy that the dates on files only go forward and not backwards. This notion of just doing a greater than comparison between the source and the object is not sufficient in my mind for a build system.


I have this problem now at work. In this case it is with C++ and make. I can check things out from ClearCase and build. But if I decide that I don't want to check the changes in and just revert back to what is in ClearCase, I'll uncheckout the file but the file date goes back to the date it was checked in. Make won't rebuild the file because it went back in time.

The problem is that to solve this you must save information about the build to overcome this. For every generated file you would have to keep a record of its timestamp and the timestamp of all its dependencies. Then when building again if any timestamp has changed then you rebuild.

subtle -- some class file it depends on has changed, e.g. a method
changed from m( char ) to m( int ), or the value of some static final
has changed, e.g.  flipping DEBUGGING = true to DEBUGGING = false.
The code to call it needs to be regenerated.

Javac will handle obvious, but not the subtle, right?

If you compile A.java it will recompile any file that A references whose class file is older than its source. The issue is that it doesn't spider its way out to anything beyond a file that is up to date.


So while A may depend on B and B is up to date with its source file there may be a hundred files that B depends on that are out of date but they won't be checked because the analysis stops at B because B was up to date.

> Bush crime family lost/embezzled $3 trillion from Pentagon.
> Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.

Please stop repeating this off-topic lie that has no business in this group!


-- Dale King .



Relevant Pages

  • Re: Parser error in Global.asax
    ... end of the file), save it and rebuild. ... In every project I try to compile and run, I'm getting a parser error on ... details and modify your source file appropriately. ... Parser Error Message: ...
    (microsoft.public.dotnet.framework.aspnet)
  • How to modify and rebuild source code (like Calibrui)?
    ... User Interface Component": ... I need to make a small change to calibrui.cpp, so I edited the source file ... I guess I don't know how to "rebuild the ... calibrui.rc, makefile, makefile.inc, and sources. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: resource files
    ... For me, patching the production binaries _of your own_ is silly, if you ... can rebuild. ... Patching the binaries _of another parties_ is not silly, ... 1.set a compilation flag in source file as you said.Depending upon that my ...
    (microsoft.public.development.device.drivers)
  • Re: Ant Help
    ... >How can we make Ant to compile only the source file in that have ... >timestamp more recent than the class files in xyz.jar. ... I'd look up info on using the ant task "depend" if I were you. ...
    (comp.lang.java.programmer)
  • __TIMESTAMP__ on xlC v8.0 indicates last compilation, not last modification
    ... AIX ep5710g 3 5 ... However on v8.0 actually __TIMESTAMP indicates the date and time when ... the source file was last compiled. ... Alex Vinokur ...
    (comp.unix.aix)