Deprecation warning in all RPCs dealing with collections on GWT 2.0 RC2

247 views
Skip to first unread message

Luis Fernando Planella Gonzalez

unread,
Dec 8, 2009, 12:24:20 PM12/8/09
to Google Web Toolkit
Hi.
We're using GWT 1.7 and I'm starting to experiment with 2.0 RC2 to
evaluate GWT.runAsync().

However, now as I compile the app, I get warning for deprecations in
all RPC methods which return collections. I guess it's because the
result is declared as java.util.Collection, and the deprecated
com.google.gwt.user.client.ui.*ListenerCollection classes extends
ArrayList, making even the alternative to change the result of RPC
methods to ArrayList instead of Collection don't work.

The log is something like this, multiple times:
[WARN] Warnings in 'generated://
8D0B12EA4B123D9B133384111C9A7E38/nl/strohalm/cyclos/client/app/users/
images/UserImageRemoteService_TypeSerializer.java'
[WARN] Line 50: Referencing deprecated class
'com.google.gwt.user.client.ui.ChangeListenerCollection'
[WARN] Line 55: Referencing deprecated class
'com.google.gwt.user.client.ui.ClickListenerCollection'
[WARN] Line 60: Referencing deprecated class
'com.google.gwt.user.client.ui.FocusListenerCollection'
[WARN] Line 65: Referencing deprecated class
'com.google.gwt.user.client.ui.FormHandlerCollection'
[WARN] Line 70: Referencing deprecated class
'com.google.gwt.user.client.ui.KeyboardListenerCollection'
[WARN] Line 75: Referencing deprecated class
'com.google.gwt.user.client.ui.LoadListenerCollection'
[WARN] Line 80: Referencing deprecated class
'com.google.gwt.user.client.ui.MouseListenerCollection'
[WARN] Line 85: Referencing deprecated class
'com.google.gwt.user.client.ui.MouseWheelListenerCollection'
[WARN] Line 90: Referencing deprecated class
'com.google.gwt.user.client.ui.PopupListenerCollection'
[WARN] Line 95: Referencing deprecated class
'com.google.gwt.user.client.ui.ScrollListenerCollection'
[WARN] Line 100: Referencing deprecated class
'com.google.gwt.user.client.ui.TabListenerCollection'
[WARN] Line 105: Referencing deprecated class
'com.google.gwt.user.client.ui.TableListenerCollection'
[WARN] Line 110: Referencing deprecated class
'com.google.gwt.user.client.ui.TreeListenerCollection'
See snapshot: /tmp/
UserImageRemoteService_TypeSerializer2951604978153994580.java

Is there a way to remove those classes from being handled in RPC?

Luis Fernando Planella Gonzalez

unread,
Dec 11, 2009, 7:19:57 AM12/11/09
to Google Web Toolkit
This issue is still present on GWT 2.0 final.
I've made some tests: creating a new GWT project with Collections in
RPC methods don't result in such code being inserted in the generated
JavaScript.
The point is: our project is quite huge, but I can confirm that there
are no occurrences of any of the ListenerCollections mentioned.
Compiling with -compileReport shows as only references for those
collections the RPC generated TypeSerializers and FieldSerializers.
Could someone, please, explain how to get rid of those unwanted (and
unused) collections in the generated code?

PS: I've read some time ago that all this deprecated code would be
removed in GWT 2. It's even in the source code that it would be
removed. Why it wasn't?!?
If it's for people using the old event listeners, I can assure that
I've migrated from GWT 1.5 to 1.7 in 1,5 days. When I first replaced
Listeners by Handlers I had 600+ compilation errors. Just changed the
inner classes and everything worked. And better. Not to count having
to rearrange the app to use the war directory. So I think this is no
excuse for keeping deprecated code, as I think that 99% of the GWT
users are working in a code base the same size or smaller than ours.

Ashar Lohmar

unread,
Dec 11, 2009, 10:04:06 AM12/11/09
to Google Web Toolkit
Hi I'm having the same kind of problem.
in my app i use some libraries/object written in Java 1.4 style
the objects implement Serializable but contain Lists or Maps which are
declare without parameters
i mean List instead of List<E>, as the Java 1.4 requires
and some RPC classes return this kind of objects but on Gwt-compiling
I endup with a lot of code referencing all kinds of Listeners and
stuffs that are unrelated to the RPC service.

Basically the messages appear because the Listeners are deprecated,but
what are they doing there in the first place ?

hope someone will clear this up

On Dec 8, 7:24 pm, Luis Fernando Planella Gonzalez

Luis Fernando Planella Gonzalez

unread,
Dec 11, 2009, 2:39:56 PM12/11/09
to Google Web Toolkit
Just found the answer, and luckily in my case it was simple to
solve....
I have a subtype of List<T> called PageImpl<T>, which had another
List<T> containing the page items, plus the total count.
Then (and I think is a problem in GWT compiler), the compiler resolves
FocusListenerCollection, which extends ArrayList<FocusListener> to be
a subclass of List<T>.
As a result, ALL occurrences of Collection of anything in any RPC
method, by having PageImpl as a subclass of collection, had added
those ListenerCollections as possible result types, generated code to
handle them (50k in my case) and issued the warnings.
The solution (in better words: hack) was to change PageImpl to not
have a List of page items, but a LinkedList (it then converts the
receiving list into a LinkedList, which is even a penalty in my case).
As no ListenerCollection extends LinkedList, the problem is gone.

Ah, I also had an RPC which result type was List<List<String>>. The
same problem. As it was just for testing, I changed it to List<String[]
>.

But I'd really want to hear from a GWT dev if this is not a bug in the
compiler...

Luis Fernando Planella Gonzalez

unread,
Dec 11, 2009, 2:44:33 PM12/11/09
to Google Web Toolkit
In fact, there is a very easy way to reproduce it:
Just create a RPC method which returns List<List<String>>. You'll see
references for those deprecated collections.

On 11 dez, 17:39, Luis Fernando Planella Gonzalez <lfpg....@gmail.com>

Al Murauski

unread,
Dec 17, 2009, 5:26:20 PM12/17/09
to Google Web Toolkit
The same problem.

We're facing this after upgrading to gwt 2.0.

Any ideas?

Thanks in advance!


On 8 дек, 19:24, Luis Fernando Planella Gonzalez <lfpg....@gmail.com>
wrote:

Raziel

unread,
Dec 18, 2009, 6:21:41 PM12/18/09
to Google Web Toolkit
I'm having the same issue: my RPC method returns beans that contains
lists, and for whatever reason these ListenerCollection classes are
added to the serialization policy.

As you can see in my case the problem is harder to identify since I
don't have ANY return type nor parameter directly extending list. The
list references come through aggregation. I understand that anyway the
serialization policy still has to take care of all types, no matter
whether they're direct return types or parameters, but I just want to
point out how this could become a more widespread issue.

On Dec 17, 5:26 pm, Al Murauski <a.murau...@gmail.com> wrote:
> The same problem.
>
> We're facing this after upgrading to gwt 2.0.
>
> Any ideas?
>
> Thanks in advance!
>
> On 8 дек, 19:24, Luis Fernando Planella Gonzalez <lfpg....@gmail.com>
> wrote:
>
>
>
> > Hi.
> > We're using GWT 1.7 and I'm starting to experiment with 2.0 RC2 to
> > evaluate GWT.runAsync().
>
> > However, now as I compile the app, I get warning for deprecations in
> > all RPC methods which return collections. I guess it's because the
> > result is declared as java.util.Collection, and the deprecated

> > com.google.gwt.user.client.ui.*ListenerCollectionclasses extends

leslie

unread,
Jan 2, 2010, 11:07:29 AM1/2/10
to Google Web Toolkit
I'm seeing the problem as well. But interestingly I didn't see the
generated warnings until I stored the List object into a variable on
the client. So the RPC call itself is not where the issue is for me.
I was returning lists from the server and only using the contents by
calling the toArray() method without saving the object instance. And
I didn't see the warnings. But then I changed the code, and stored
the resultant List<Foo> object into a variable on the client,
specifically into a gui class, and that's when the warnings all
appeared.

leslie

unread,
Jan 2, 2010, 12:24:33 PM1/2/10
to Google Web Toolkit
Bah. Writing in haste I worded it so badly.

> until I stored the List object into a variable on the client.

I should have said: until in my client code I assigned the object of
type List to a variable declared as type List.

> and stored the resultant List<Foo> object into a variable on the client

Should read: and assigned the List<Foo> or List<Object> object to a
variable of type List<Foo> or List<Object>

Chris Ramsdale

unread,
Jan 3, 2010, 4:32:00 PM1/3/10
to google-we...@googlegroups.com
This is a bug. The List<List<Object>> return type is causing the compiler to generate serialization code for any class X that extends List<T>, where T is an interface that has a implementing class that extends class X. The following code will reproduce the issue:

@Deprecated
public class MyTest extends java.util.ArrayList<MyTestInterface>{}

public class MyTestInterfaceImpl extends MyTest implements MyTestInterface {}

public class MyTestInterfaceImpl extends MyTest implements MyTestInterface {}


Could you add a bug to the GWT issue tracker

- Chris

--

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



Luis Fernando Planella Gonzalez

unread,
Jan 4, 2010, 8:36:48 AM1/4/10
to Google Web Toolkit

Bert

unread,
Jan 6, 2010, 8:14:24 AM1/6/10
to Google Web Toolkit
I'm experiencing the same problem.

On Dec 8 2009, 6:24 pm, Luis Fernando Planella Gonzalez

Chris Ramsdale

unread,
Jan 6, 2010, 1:42:08 PM1/6/10
to google-we...@googlegroups.com
Please star the issue and add any relevant data you may have. 

- Chris

Chris Ramsdale

unread,
Jan 8, 2010, 3:12:47 PM1/8/10
to google-we...@googlegroups.com
I've updated the issue (http://code.google.com/p/google-web-toolkit/issues/detail?id=4438) with a workaround, let me know if it doesn't work for anyone. 

- Chris
Reply all
Reply to author
Forward
0 new messages