ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Pettiss" <>
Subject RE: javac, depend, and interface constants
Date Mon, 23 Jul 2001 17:47:35 GMT
Final constants are hardcoded directly in the classes that use them, for
performance reasons.  This is in the java spec (since 1.0).  If you make a
change to the interface/class that defines these constants, but don't
recompile the classes that use them, you'll run into *big trouble*.

The javac task fortunately has a 'depend="true"' option, which turns on
dependency analysis in the compiler (so that extra files other than those
specified can be brought in and recompiled as needed).  This slows things
down some, but if clean builds are regular practice for you, then you may
want this option.

--jason pettiss
AGEA Corporation

-----Original Message-----
From: Larry V. Streepy, Jr. []
Sent: Monday, July 23, 2001 10:05 AM
To: ant user mail list
Subject: javac, depend, and interface constants

All, I know this is question is more general than just ant, but it stems
from the use of the javac and depend tasks.

I'm trying to add usage of the depend task to our current build system.
I need it for the obvious reasons of not wanting to do a full clean and
build in order to catch dependencies during recompile.

Since the javac task only hands the list of filenames that have modified
to the underlying compiler, the compiler can't do proper dependency
analysis. Thus I'm working on the depend task.

Enough background, here's the problem.

I have an interface that defines constants (public static final).
I have another class that uses those constants.

If I change one of the constants in the interface the depend task does
not remove the class file for the dependent class.

After some digging, it appears that the compiler is removing the actual
class member references and just embedding the constant directly into
the generated class file.  This happens even with debug turned on and
optimization turned off.  Even declaring them as non-final seems to have
no effect.

Does anyone have ideas on how to fix, prevent, work around this?

Larry V. Streepy, Jr.
Chief Technical Officer and VP of Engineering

Health Language, Inc.  -- "We speak the language of healthcare"

970/626-5028 (office) 
970/626-4425 (fax)    

View raw message