[plug] Save a soul from scripting insanity...
Russell Keith-Magee
Russell.Magee at calytrix.com
Thu Aug 15 07:55:44 WST 2002
> On Tue, Aug 13, 2002 at 11:38:11AM +0800, Russell Keith-Magee wrote:
> > I have a large number of Java source files, which contain a
> large number of
> > function calls to a translation engine:
> >
> > Translator.translate("Foobar");
>
> Is it possible to mock up your own class instance called Translator,
> with a method translate written for 1, 2, 3, 4 or however many
> parameters you need, and just compile the java source files?
>
> This'll fail if the code uses other classes that you're missing, but
> if you know all your source files use only Translator and some
> standard java, then this will be the most reliable method, as you
> let the Java compiler do the parsing.
Translator is my own method anyway, so I can hack it as much as I need.
The problem is that once I have done this, I need to make sure EVERY call to
Translator in the source code is exercised. The compiler will parse the
code, but it won't extracted the translation strings for me. The strings are
what I need. Running the program and catching the calls to
Translator.translate doesn't work either, as there is no way to guarantee
that every translator string has been used.
The only way I can think of making the compiler approach work is to pillage
the bytecode, and pull out the strings from there.
Russ %-)
********************************************
Dr Russell Keith-Magee
Software Engineer
Calytrix Technologies
Unit 9, EIR Building, Technology Park
PO Box 1173, BENTLEY 6982, Western Australia
More information about the plug
mailing list