bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU automake and Java, inconsistency after changes


From: roman . fietze
Subject: GNU automake and Java, inconsistency after changes
Date: Mon, 16 Feb 2004 12:56:05 +0200


Hello,

I had to create some Java code, not being asked if I really like that :)

Now I sometimes get runtiome errors that could have been caught at
compile time.


Example:

I have two files A.java and B.java

Assume class A in A.java has a function "void f(int i)" and B is
calling that properly. Now you "make" the program and everything is
fine. Then you edit A.java and change "void f(int i)" to "void f()" and
do one more "make". It'll compile and you do *not* get an error
reported, because in the compile rule for Java (as of automake 1.8.2)
...

--------------------------------------------------

classjava.stamp: $(java_JAVA)
                @if test -n "$?"; then \
                  echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $?' ; \
                  $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) \
                    $(AM_JAVACFLAGS) $(JAVACFLAGS) $?; \
                else :; fi
                echo timestamp > classjava.stamp

--------------------------------------------------

... there stands a "$?" as the list of the files to be recompiled,
which would only be A.java. Because javac is smart enough not to
recompile everything, it would probably bee better to recompile all
Java sources (replace "$?" with "$(java_JAVA)") to catch that error,

because when recompiling parsing both files, javac will detect the change
in A.java and recompile both files, detecting the inconsistency.

I do not know how performant that chhange would be with really large
Java subdirectories.

Are there any reasons why you went with "$?" that I do not know and
cannot imagine?


Roman

--
Roman Fietze    Telemotive AG

reply via email to

[Prev in Thread] Current Thread [Next in Thread]