Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 67749 invoked by uid 500); 23 Jul 2001 11:15:29 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 67740 invoked from network); 23 Jul 2001 11:15:29 -0000 Date: 23 Jul 2001 11:15:25 -0000 Message-ID: <20010723111525.2194.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: ant-dev@jakarta.apache.org Cc: Subject: [Bug 2736] New: - Ant javac task has problems with dependencies X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2736 *** shadow/2736 Mon Jul 23 04:15:24 2001 --- shadow/2736.tmp.2191 Mon Jul 23 04:15:24 2001 *************** *** 0 **** --- 1,170 ---- + +============================================================================+ + | Ant javac task has problems with dependencies | + +----------------------------------------------------------------------------+ + | Bug #: 2736 Product: Ant | + | Status: NEW Version: Nightly build | + | Resolution: Platform: All | + | Severity: Major OS/Version: All | + | Priority: Other Component: Core tasks | + +----------------------------------------------------------------------------+ + | Assigned To: ant-dev@jakarta.apache.org | + | Reported By: peter.van_der_goten@alcatel.be | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + This bug was found in Ant1.3 and + also found in the latest nightly build of ant (2001-07-22) + file: jakarta-ant-1.4alpha-bin.zip + I thid the tests on NT for the 1.4aplha release and found the + bug on unix for the 1.3 release. + + In our project we noticed some problems with depencies concerning interfaces + used to specify constants. + It seemed that the constants are inlined in the .class files and these .class + files which use the contsants where NOT recompiled when a constant was changed. + + To test this I made a simple application which uses two other .java files + in which only public final consts where defined in an interface. + (in the manner we use in our project) + + The bug could be reproduced with ant but NOT with javac or jikes used on + there own. + + The build .xml file I used + + + + + + + + + + + + + + + + + + the java files: + //AnOtherTestConstsITF.java + package be.alcatel.another; + + public interface AnOtherTestConstsITF{ + public static final String const2 = "2"; + } + //TestConstsITF + package be.alcatel.test; + + public interface TestConstsITF{ + public static final int const1 = 1; + } + //Test.java + package be.alcatel.test; + + import be.alcatel.another.*; + + public class Test implements TestConstsITF, AnOtherTestConstsITF{ + + public void printConsts(){ + System.err.println("TestConstsITF.const1 = "+TestConstsITF.const1); + System.err.println("const1 = "+const1); + System.err.println("AnOtherTestConstsITF.const2 = + "+AnOtherTestConstsITF.const2); + System.err.println("const2 = "+const2); + } + + public static void main (String[] args){ + Test t = new Test(); + t.printConsts(); + } + } + + The project direcotory structure: + Projroot + Src + be + alcatel + test + Test.java + TestConstsITF.java + another + AnOtherTestConstsITF.java + Classes + be + alcatel + test + Test.class + TestConstsITF.class + another + AnOtherTestConstsITF.class + + Build.bat used to build this example + + @echo off + @setlocal + set PSD_VOB=D:\Projects\comptest + set PF_TOOLS=F:\PFTools + + set JAVA_HOME=%PF_TOOLS%\j2sdk1.3.1-win + set J2EE_HOME=%PF_TOOLS%\bea\wlserver6.0sp1 + set BUILDFILE=D:\Projects\comptest\build.xml + + rem set ANT_HOME=%PF_TOOLS%\jakarta-ant1.3 + set ANT_HOME=D:\jakarta-ant-1.4alpha + + set CPATH=%JAVA_HOME%\lib\tools.jar + set CPATH=%CPATH%;%J2EE_HOME%\lib\weblogic.jar + set CPATH=%CPATH%;%ANT_HOME%\lib\ant.jar + rem set CPATH=%CPATH%;%ANT_HOME%\lib\jakarta-ant-1.3-optional.jar + set CPATH=%CPATH%;%ANT_HOME%\lib\jakarta-ant-1.4alpha-optional.jar + set CPATH=%CPATH%;%ANT_HOME%\lib\parser.jar + set CPATH=%CPATH%;%ANT_HOME%\lib\crimson.jar + set CPATH=%CPATH%;%ANT_HOME%\lib\jaxp.jar + set CPATH=%CPATH%;%PF_VOB%\build\ant\lib\PFant.jar + + %JAVA_HOME%\bin\java -classpath %CPATH% -Dant.home="%ANT_HOME%" + org.apache.tools.ant.Main -buildfile %BUILDFILE% -Dbasedir=%PSD_VOB% + -Dlibdir=tmp -Dtools=%PF_TOOLS% -quiet %1 %2 %3 %4 %5 %6 %7 %8 %9 + + @endlocal + + When the project is rebuild using an adapted version of + AnOtherTestConstsITF.java + The only class file that is new will be AnOtherTestConstsITF.class + Because the constats of this class where inlinde by the compiler in Test.class + the Test.class file should have been recompiled. + In fact this is done by the standard javac tool or jikes (without using ant) + + If make.bat is used all is well (doesn't use ant) + @echo off + + rem make.bat for the test + + set PRJDIR=D:\Projects\comptest + set JDK_HOME=c:\jdk1.3.0_02\bin + set CLASSDIR=%PRJDIR%\Classes + set SRCDIR=%PRJDIR%\Src + set JARDIR=%PRJDIR%\jar + + + @echo compiling... + start /b /wait /d%PRJDIR% jikes -depend -sourcepath %SRCDIR% -classpath + .;%CLASSDIR%;c:\jdk1.3.0_02\jre\lib\rt.jar -d %CLASSDIR% + %SRCDIR%\be\alcatel\test\*.java + + notice that i use -depend (but it will also work without it) + the depend flag was also used in the build.xml file (see above) + + Best regards, + Peter Van der Goten