On Fri, Jul 24, 2009 at 6:01 AM, Alen Vrecko <[email protected]> wrote:
> > 1) A generator uses the SystemCL. Not recommended because it won't see
> > changes in client code unless hot-replace is working.
> >
> > 2) A generator uses TypeOracle. Recommended; changes are picked up on
> > refresh.
> >
> > 3) A generator uses the TypeOracleClassLoader. Useful for interacting
> with
> > reflection-based code, changes are picked up on refresh.
> >
> > I see no reason to support #1 in any way, or worry about mixed-use for #1
> > and #3.
>
> Just to be sure. We are talking at #3 about generator loaded in System
> that is using TOCL?
>
Yes.
> I think we have a different opinion in only one thing. I'd like to
> guarantee generators "identity" i.e. if this is generator code
>
> Foo foo = (Foo) ctx.getTypeOracleClassLoader("com.foo.Foo"); even if
> there is a new Foo available it will return the one from System since
> Foo is directly referenced by the generator. On the other hand Class<?
> > clazz = ctx.getTypeOracleClassLoader("com.Bar") will return class
> from TOCL since it is not directly referenced by the generator.
>
I just don't see how that's tractable. What are you proposing, analyze the
Generator class's bytecode to see what classed it directly references? But
it might depend on other libraries, so how deep does that rabbit hole go?
> Something like
> ctx.getTypeOracleClassLoader().useSystemFor().startingWith
> ("com.foo.client.").equalTo("com.foo.client2.Baz").create();
>
> in GIN's case we could then do
> ctx.getTypeOracleClassLoader().useSystemFor().startingWith
> ("com.google.gwt.inject.").create(); and not worry about any
> surprises.
>
That seems, complicated and unnecessary. If you really, really need the
SystemCL version of a class, you'd just access it directly. If you want to
reflect over the client code as a holistic unit, you'd use the
TypeOracleClassLoader. I prefer clarity to warm and fuzzy.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---