This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Applet and Servlet Compile Options


Hi Per,

I started to work on the `applet:` and `servlet:` module compile
options. It is a bit harder than what I was thinking.

The problem comes from the moment at which `module-compile-options`
are parsed. Indeed, just before parsing, `Compilation` will push the
module being compiled with `pushNewModule`. In this code, we check if
we are generating an applet or a servlet and then, we set the flag
`SUPERTYPE_SPECIFIED` on the module.

However, at this time, module compile options are not known and the
flag is not set. So, I checked how this is done for the
`module-extends` option, since it's the same behavior, i.e. supertype
is defined after `pushNewModule`. For this syntax, the flag is set
directly in the code handling the `module-extends`.

Doing the same for `module-compile-options` would be a bit odd because
this syntax is generic and I would need to put specific stuff in it.
So, to overcome the problem, what I did is to create an
`OptionsListener` class that can be attached to an `Options` instance.
Then, the `Compilation` set a listener on the options and when a key
is set we set the flag `SUPERTYPE_SPECIFIED` type if the key is
`applet`. This work as expected, for `module-compile-options` and for
the `--applet` command line arguments.

I don't know if it's the best way to do it. maybe there is another
trick to solve the problem. I attached the patch for the `applet:`
keyword only so you can check the current implementation. I would like
to know if I'm going in the right direction. If not, how could I
implement the feature?

Regards.
Matt

Attachment: module-compile-options-applet.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]