preprocessing java source
Tom Tromey
tromey@redhat.com
Sun Jun 24 11:05:00 GMT 2001
>>>>> " Artur" == Artur Biesiadowski <abies@pg.gda.pl> writes:
>> I think the only preprocessing required will be to support...
>> #ifdef USE_FINALIZATION
>> #else
>> #endif
Artur> I would suggest not forcing any preprocessor by default (for
Artur> full class). Then using some invisible tags (like //IFDEF
Artur> something ) conditionally leave something out of compilation
Artur> for smaller targets.
I like this idea better than using cpp.
I think ideally the preprocessor would simply comment out lines
instead of removing them. That way the line numbers match with the
original source.
One idea I had a long time ago was to annotate methods and fields with
conditions describing their use:
public void foo ()
throws whatever
if (JDK_VERSION == 1.2 && ! J2ME)
Of course this requires a hairier preprocessor or compiler changes.
One nice feature of this approach is that you could compile all the
alternatives and have them all in the .class file (appropriately
annotated). That way you could, say, build libgcj in its most generic
form and then let the user choose the profile at compile time with
`gcj -std=J2ME' or whatever.
Tom
More information about the Java
mailing list