When you type javac *.java
yourself, you are in fact using option #1 from my previous post [submitting the entire set of classes to javac to recompile]. This is the only supported way to make javac look at everything. However, this is _not_ what ANT does internally. Typically, when the compiler is set to javac it will create a list of files to be recompiled [to be used via an @file argument, I believe]. That list is the input .java fileset, filtered according to modification file timestamps [which is the important bit]. Thus, ActualClass will be filtered out, because ActualClass.class will appear to be up-to-date with respect to ActualClass.java [but what you really want and ANT can't do it figure out that ActualClass.class is not up-of-date with respect to AbstractClass.java]. Vlad. Please respond to "Ant Users List" <[EMAIL PROTECTED]> To: "Ant Users List" <[EMAIL PROTECTED]> cc: Subject: RE: newbie question: javac not checking build dependencies? Now I'm pretty confused. This seems to work just fine for me in javac right now. If I have an abstract class (let's say AbstractClass), then a subclass (let's say ActualClass), and I add a method signature like public abstract int notThereYet(); to AbstractClass.java, then when I type javac *.java it gives me an error like: ActualClass should be declared abstract; it does not define notThereYet() in AbstractClass ... even though I haven't deleted ActualClass.class, or touched ActualClass.java, and there's no reason for javac to recompile it. I always assumed that javac had some kind of separate linking phase after compiling the different .java files into .class files. Francis > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 4:39 PM > To: Ant Users List > Subject: Re: newbie question: javac not checking build dependencies? > > > Your mistake was in assuming that javac actually had this dependency > checking ability. It never did. That and Java just does not support > separate compilation units very well as a language [for many different > reasons, including static linking for static final constants etc]. > > ANT compensates for that a little bit by doing file timestamp checking, > like most make processors can. But that does not work in many cases [like > yours: ANT can't know that one of your classes is an extension of another > without parsing Java]. To do everything correctly, the complete set of > dependencies needs to be extracted from Java class definitions -- > and that > amounts to pretty much parsing everything every time, rather expensive. > > Your choices are: > > - live with this javac limitation and always submit the full set of > classes to be recompiled. > - use a different compiler with built-in dependency analysis [jikes? The > compiler in IBM's Eclipse is pretty smart, too.] > - use some sort of a Java dependecy manager tool. They all differ in how > smart they are. For some useful reading, check out this link [posted to > this list a while ago]: > http://www.experimentalstuff.com/Technologies/JavaMake/javamake.html > > Vlad. > > > Please respond to "Ant Users List" <[EMAIL PROTECTED]> > To: "Ant Users List" <[EMAIL PROTECTED]> > cc: > > Subject: newbie question: javac not checking build dependencies? > > > A quick question from someone who just started using Ant: > > For some reason the javac task doesn't seem to check dependencies after it > builds. Let's say I modify a superclass to add a new abstract method, and > I > leave the subclass alone. When I run javac in the command line, I get a > compile-time error when I compile, saying that the subclass needs to > implement the new method. > > But when I run a javac task in Ant, it doesn't detect this. (Until it gets > to the junit task, at which point most everything fails.) > > Obviously there's something really basic I'm doing wrong. Any pointers to > where I should look to figure out what to fix would be greatly > appreciated. > > Thanks > > Francis > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
