Yes, my constants are "public static final". The problem, I found, is that the
definition of VERSION is a method evaluation, not a compile-time constant, as you had
tried. So that answers that question.
The remaining issue is back on the file that I really want to use,
Diagnostic.class. Changing nothing except the class name & path to point to
this file causes an IOException, so it looks like a bug to me. Who does one inform
of such things?
BTW, Erik thanks for your <prefixlines> tip regarding constants!
On Mon, 24 Jan 2005 12:14:56 -0500, Erik Hatcher <[EMAIL PROTECTED]> wrote:
On Jan 24, 2005, at 11:05 AM, michael sorens wrote:
(1) Well I tried adding bcel.jar to my ant/lib directory but it made
no difference.
What did make a difference was my choice of .class file to load.
Instead of my Diagnostic.class
I tried a simpler Version.class and then I received no error, even
*without* bcel.jar. So this seems like a data-dependent bug...
Did you make your VERSION be "public static final"? I just tried it
(had to download and install BCEL into ANT_HOME/lib myself) with this
class:
public class Test {
public static final String VERSION = "version";
}
I also tried it with an int:
public static final int VERSION = 123;
with this build file snippet:
<loadproperties srcfile="build/Test.class">
<filterchain>
<classconstants/>
</filterchain>
</loadproperties>
<echo>${VERSION}</echo>
(2) As I could successfully execute with my Version.class, how do I
then *access* the properties?
I have a constant named VERSION. I tried <echo> with "${VERSION}" and
with "${com.cleancode.data.Version.VERSION}" but neither had a value.
What are the rules for the name of a property from a class file?
the property name is the constant name, no package prefix is added.
Though a slick trick is to use a <prefixlines prefix="constants."/>
after <classconstants>.
My guess is your property is not public static final.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]