use Tatoo's compiler as front end of javac

Rémi Forax forax at univ-mlv.fr
Thu Dec 18 02:22:13 PST 2008


Jonathan Gibbons a écrit :
> Rémi,
>
> Thanks for the suggested patch. I'm thinking it might be worth
> investigating this one step further, and see if we can leverage the
> JDK ServiceLoader mechanism to come up with a more general
> mechanism that would apply to any object that might be found via
> the javac Context.
ServiceLoader requires an empty constructor and
objects store in a Content are constructed with that context.

I don't see how to use it without modifications of java.util.ServiceLoader.
>
> I can see 3 possibilities:
>
> Early: as soon as the context is created, populate it with any
> objects found via the service loader.
>
> Later: after the command line options have been read, populate
> the context with any objects found via the service loader. This
> will allow the ability to select objects via hidden command line
> options.
>
> Latest: on an instance by instance basis, check the service loader
> before creating each default object for the context. This is the
> most expensive option, since it requires checking the service
> loader on an object by object basis; the previous two options
> would just require one access to the service loader, for any/all
> objects to put in the context.
In my opinion, this should be done in instance(),
(your latest solution), Context is already a cache
but again there is no way to get the service class from a ServiceLoader.

>
> We could also go for a radically different dependency injection
> framework, but I'd prefer to go for a small/lightweight change,
> and not any major refactoring at this time.
yes, we could :)
>
> -- Jon
Rémi



More information about the compiler-grammar-dev mailing list