ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francis Hwang" <fran...@latinred.net>
Subject RE: newbie question: javac not checking build dependencies?
Date Thu, 03 Jan 2002 15:58:11 GMT
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: vlad@trilogy.com [mailto:vlad@trilogy.com]
> 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" <ant-user@jakarta.apache.org>
> To:     "Ant Users List" <ant-user@jakarta.apache.org>
> 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:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message