You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2001/12/19 20:34:20 UTC

DO NOT REPLY [Bug 4372] - Javac task always generates optional -sourcepath switch

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4372>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4372

Javac task always generates optional -sourcepath switch

jwinshell@bearriver.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scottsh@attachmate.com
             Status|RESOLVED                    |REOPENED
         OS/Version|Windows NT/2K               |MacOS X
           Priority|Other                       |High
           Platform|PC                          |All
         Resolution|INVALID                     |
            Version|1.4                         |1.4.1



------- Additional Comments From jwinshell@bearriver.com  2001-12-19 11:34 -------
Sorry, this is a bug.   I too ran into this after switching from jikes to standard javac.   Works properly with jikes, not with javac.  

The documentation for javac in the section for "searching for types" says ( http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html )
"
If you use the -sourcepath option, the compiler searches the indicated path for source files; otherwise the compiler searches the user class path both for class files and source files. 
"

Example:

Suppose I have:

thatpackage/ThatClass.java

and 
thispackage/ThisClass.java  which include an
import "thatpackage.ThatClass";
...
ThatClass that = new ThatClass();

Then invoking javac as 

javac -classpath "thispackage:thatpackage" thispackage/ThisClass.java

would implicitly look for the source thatpackage/ThatClass.java in the classpath during attempt to resolve the reference of ThatPackage.ThatClass from ThisPackage.ThatClass.java when it found that the thatPackage/ThatClass.class was missing.

if invoked as the javac task does:
javac -sourcepath "thispackage" -classpath "thispackage:thatpackage" thispackage/ThisClass.java
a compiler error results complaining about not being able to resolve uses of ThatPackage.ThatClass within ThisPackage.ThisClass.   This is because javac will NOT look for the source ThatClass.java anywhere but the specified sourcepath.     That the bug.

Jason Winshell, Principal Consulting Engineer     jwinshell@bearriver.com
Bear River Associates, Inc.                      http://www.bearriver.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>