Well as a work around to see if/where gwtc is needing class A you
could create a "dummy" class using the super directive in your module
gwt that is serializable (and empty).

On Feb 4, 8:42 am, getaceres <[email protected]> wrote:
> I chose the wrong letter to describe my algorithm. Going to my
> example:
>
> Class A not serializable.
> Class B serializable but with a B.field of type A marked as transient.
>
> In this case, only B has to be taken into account, which is the only
> class that uses A. The compiler would ignore completely A and mark
> B.field and all the methods in B which use B.field as invalid (not
> translatable). If any class C uses a method in B which has been marked
> as invalid, then the compilation fails. In this case, there isn't any
> possible mistake. The only way to use B.field or any invalid method in
> B and not declaring it in the code would be to use reflection, which
> is not supported by GWT so if the code compiles, it will work for
> sure. At least, no one will ever call any method which uses directly
> or indirectly something related to A because in that case, the
> compilation would have failed.
>
> I don't know much about modern compilers (apart from flex and yacc)
> and much less about the GWT compiler, but I don't think that
> implementing this would be very complex. On the code analysis of B
> (lexical or semantical) you put some information in a Hash Table which
> is consulted every time another class uses B.something. Of course,
> this will slow the compilation process, specially if B is a overused
> class which has a lot of functionality, but at least for me, it would
> be worth the extra compilation time just to be able to reduce my
> duplicated code.
>
> On 22 ene, 10:43, Chris Lercher <[email protected]> wrote:
>
>
>
> > Compilers usually need full type information before they can tell, who
> > calls who. So this will probably add an additional compile step (or
> > maybe change the compiler architecture?) Still, I think your suggested
> > soultion uses a good approach, and you should create an entry in the
> > issue tracker for this.
>
> > Thinking about it, however, I personally wouldn't include this
> > functionality directly in the compiler: Even if it succeeds and
> > doesn't slow the compiler too much down, it means that the compiler
> > will accept classes that are partially invalid (class B could call
> > anything on class A, the compiler won't be able to check this, if it
> > decides to ignore A). This would create rather strange semantics for
> > "my class compiles successfully" - it depends on the question, if some
> > methods will be used or not.
>
> > However, I see two possible alternative solutions:
>
> > (A) Provide a pre-compiler that removes specially annotated fields. It
> > will be necessary to annotate the methods that access the fields
> > (directly or indirectly), too. Then allow GWTRPC serialization to
> > interact between the two versions of the class.
>
> > or (B) In addition to <source path="..."/> in the module xml, there
> > could be an element <source-dependency path="..."/>, which would mean:
> > Don't attempt to compile the java files in that path, but only read
> > their signature (basically treat the classes similar to interfaces).
> > This way, the type information can be provided to the compiler, and it
> > can work as usual. It would require however, that the java file is
> > available to you - you can't use this, if you only have the .class
> > files.
> > [In your case, getaceres, you'd add the package 'pack' to the source-
> > dependency path.]
>
> > I'm a lot more for (A), because it keeps semantics clean. Keep in mind
> > that in reality, you're trying to use different versions of the class
> > on the server and client. All you want is, that you don't have to
> > write and maintain the two similar versions (which is a legitimate
> > reason).
>
> > On Jan 22, 8:48 am, getaceres <[email protected]> wrote:
>
> > > Let's say that you have Class A with a transient method A.field marked
> > > as transient in java or with theGwtTransientannotation:
>
> > > - Mark field A.field and every method in A that uses field as
> > > unavailable.
> > > - If you find in the client code a class that uses A.field or any of
> > > the methods of A marked as unavailable, fail the compilation and
> > > inform the user about "Line X,Y: Use of transient method A.method".
> > > - Now the user either, removes the calling method from its code or
> > > removes the transient keyword from the field.
>
> > > In my case, that wold be enough since I will not ever call any of this
> > > getter or setters in the GWT code.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to