randombits-org / gwt-dispatch

Implements a reusable 'command pattern' API for GWT.
10 stars 1 forks source link

Depreaction with GWT trunk #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First, thanks for great library :)

I'm getting some deprecation warnings with current GWT trunk, would it be 
possible to fix those in gwt-dispatch's trunk?

      Adding '41' new generated units
         Validating newly compiled units
            Removing units with errors
               [WARN] Warnings in 'transient source for 
net.customware.gwt.dispatch.client.service.DispatchService_TypeSerializer'
                  [WARN] Line 20: Referencing deprecated class 
'com.google.gwt.user.client.rpc.SerializableException'
                  See snapshot: 
/tmp/net.customware.gwt.dispatch.client.service.DispatchService_TypeSeriali
zer171619982950148131.java
               [WARN] Warnings in 'transient source for 
com.google.gwt.user.client.rpc.SerializableException_FieldSerializer'
                  [WARN] Line 9: Referencing deprecated class 
'com.google.gwt.user.client.rpc.SerializableException'
                  See snapshot: 
/tmp/com.google.gwt.user.client.rpc.SerializableException_FieldSerializer63
42136690734861062.java

Original issue reported on code.google.com by dusan.ma...@gmail.com on 26 Oct 2009 at 12:00

GoogleCodeExporter commented 9 years ago
I get same warning in gwt2.0

Compiling module com.app.gwt.main.Main
   Scanning for additional dependencies: 
file:/Users/tail/Workspaces/MyEclipse%208.x/app/src/net/customware/gwt/dispatch
/client/DefaultDispatchAsync.java
      Adding '245' new generated units
         Validating newly compiled units
            [WARN] Warnings in 
'generated://8A319F04B93933F77700993C274558AE/net/customware/gwt/dispatc
h/client/service/DispatchService_TypeSerializer.java'
               [WARN] Line 1001: Referencing deprecated class 
'com.google.gwt.user.client.rpc.SerializableException'
               [WARN] Line 1016: Referencing deprecated class 
'com.google.gwt.user.client.ui.ChangeListenerCollection'
               [WARN] Line 1021: Referencing deprecated class 
'com.google.gwt.user.client.ui.ClickListenerCollection'
               [WARN] Line 1026: Referencing deprecated class 
'com.google.gwt.user.client.ui.FocusListenerCollection'
               [WARN] Line 1031: Referencing deprecated class 
'com.google.gwt.user.client.ui.FormHandlerCollection'
               [WARN] Line 1036: Referencing deprecated class 
'com.google.gwt.user.client.ui.KeyboardListenerCollection'
               [WARN] Line 1041: Referencing deprecated class 
'com.google.gwt.user.client.ui.LoadListenerCollection'
               [WARN] Line 1046: Referencing deprecated class 
'com.google.gwt.user.client.ui.MouseListenerCollection'
               [WARN] Line 1051: Referencing deprecated class 
'com.google.gwt.user.client.ui.MouseWheelListenerCollection'
               [WARN] Line 1056: Referencing deprecated class 
'com.google.gwt.user.client.ui.PopupListenerCollection'
               [WARN] Line 1061: Referencing deprecated class 
'com.google.gwt.user.client.ui.ScrollListenerCollection'
               [WARN] Line 1066: Referencing deprecated class 
'com.google.gwt.user.client.ui.TabListenerCollection'
               [WARN] Line 1071: Referencing deprecated class 
'com.google.gwt.user.client.ui.TableListenerCollection'
               [WARN] Line 1076: Referencing deprecated class 
'com.google.gwt.user.client.ui.TreeListenerCollection'
               See snapshot: /var/folders/gl/glxSirZ-H7yCo1-VmudXtE+++TI/-Tmp-
/DispatchService_TypeSerializer7740451598807647032.java
   Compiling 2 permutations
      Compiling permutation 0...
      Compiling permutation 1...
   Compile of permutations succeeded

Original comment by jft...@gmail.com on 12 Dec 2009 at 5:39

GoogleCodeExporter commented 9 years ago
Same here

Original comment by christop...@gmail.com on 12 Dec 2009 at 5:21

GoogleCodeExporter commented 9 years ago
I got the same warning as above, after that I tried using RuntimeException 
instead of
Exception in the RemoteService definition, and the warning disappeared.

An example is followed:

public interface MyService extends RemoteService {
    public Boolean login(String account, String password) throws RuntimeException;  //
using Exception here will cause an GWT warning.
}

Original comment by panjunb...@gmail.com on 24 Dec 2009 at 4:12

GoogleCodeExporter commented 9 years ago
Hi, I have got another solution, just as followed:

1. Define an Exception which implements IsSerializable:
public class SerializedException extends Exception implements IsSerializable {
}

2. Throw SerializedException instead of Exception in the RemoteService 
definition:
public interface MyService extends RemoteService {
    public Boolean login(String account, String password) throws SerializedException;  //
using Exception here will cause an GWT warning.
}

Original comment by panjunb...@gmail.com on 24 Dec 2009 at 8:17

GoogleCodeExporter commented 9 years ago
Hi there,

can you name the files where I have to change the Exception to get rid of the 
Warnings?

Thanks
Karsten

Original comment by kars...@porkypie.de on 8 Apr 2010 at 6:14

GoogleCodeExporter commented 9 years ago
Hi Karsten,

Just open the declaration file for the specific exception class and modify it.

For example, given that you have a StockService as followed:

public interface StockService extends RemoteService {
    public void addStock(String symbol) throws NotLoggedInException;
    public void removeStock(String symbol) throws NotLoggedInException;
    public String[] getStocks() throws NotLoggedInException;
}

Then you should have a declaration file NotLoggedInException.java for the 
exception 
class. 

import java.io.Serializable;

public class NotLoggedInException extends Exception implements Serializable {

    public NotLoggedInException() {
        super();
    }

    public NotLoggedInException(String message) {
        super(message);
    }

}

Original comment by panjunb...@gmail.com on 8 Apr 2010 at 6:35

GoogleCodeExporter commented 9 years ago
Hi,

the problem ist, that I don't use "extends RemoteService" in my classes.

The warning I get are below...

Thanks for your help

Warnings in
'generated://5FD0222B99A8F2FBD1030A10A2C975B2/net/customware/gwt/dispatch/client
/service/DispatchService_TypeSerializer.java'
Line 80: Referencing deprecated class
com.google.gwt.user.client.rpc.SerializableException'
Line 95: Referencing deprecated class
'com.google.gwt.user.client.ui.ChangeListenerCollection'
Line 100: Referencing deprecated class
'com.google.gwt.user.client.ui.ClickListenerCollection'
Line 105: Referencing deprecated class
'com.google.gwt.user.client.ui.FocusListenerCollection'
Line 110: Referencing deprecated class
'com.google.gwt.user.client.ui.KeyboardListenerCollection'

Original comment by kars...@porkypie.de on 13 Apr 2010 at 10:59

GoogleCodeExporter commented 9 years ago
Hi,
All these classes shown in the warnings have been deprecated according to SDK 
API 
Reference of the latest version of GWT. Try to replace SerializableException 
with 
SerializationException or just Exception in the file 
"src/net/customware/gwt/dispatch/client/service/DispatchService_TypeSerializer.j
ava"

Original comment by panjunb...@gmail.com on 13 Apr 2010 at 1:35

GoogleCodeExporter commented 9 years ago
Hi,
I am checking the source of gwt-dispatch and fail to find the  
DispatchService_TypeSerializer class file. Could you please check you version 
of gwt-
dispatch, and see whether there is such a class?

Original comment by panjunb...@gmail.com on 13 Apr 2010 at 1:53

GoogleCodeExporter commented 9 years ago
Hi,

I am using version 1.0.0 from gwt-dispatch. I think the 

DispatchService_TypeSerializer.java will be created while starting (wrapper?)

While starting the file is located in C:\UserDir\AppData\Local\Temp and the 
name is
Dispatch_TypeSerializerxxxxxxxxxxx.java (xxxxxx is a random number I think and 
it
changed every start.

Original comment by kars...@porkypie.de on 14 Apr 2010 at 5:57

GoogleCodeExporter commented 9 years ago
Updated to get this working with GWT 2.0 in the gwt-dispatch 2.0 milestone.

Original comment by Bitmei...@gmail.com on 25 Apr 2010 at 1:49

GoogleCodeExporter commented 9 years ago

Original comment by Bitmei...@gmail.com on 25 Apr 2010 at 1:49

GoogleCodeExporter commented 9 years ago
Is there a link to download the milestone to test it or should I wait with the
download until it is final and live with the deprecated warnings until then?

Thanks for the help

Original comment by kars...@porkypie.de on 26 Apr 2010 at 7:02

GoogleCodeExporter commented 9 years ago
We haven't started work on the 2.0 branch yet. Working on getting 1.1 out in a 
final form, then will focus on 2.0.

Original comment by Bitmei...@gmail.com on 27 Apr 2010 at 11:21

GoogleCodeExporter commented 9 years ago
I've been unable to figure out what is generating the warnings. There are two 
exceptions used by the Dispatch 
service(s) - ActionException and ServiceException, both of which extend 
Exception and implement Serializable, 
as per the GWT documentation. Not sure what else can be done here...

Original comment by Bitmei...@gmail.com on 28 Apr 2010 at 7:01

GoogleCodeExporter commented 9 years ago
There was a suggestion for using SerializationException at
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/20e53cbe2
8c9d4b2
. This will also help decrease the compiled GWT output.

Original comment by robert.munteanu on 2 May 2010 at 8:10

GoogleCodeExporter commented 9 years ago
There was a suggestion for using SerializationException at
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/20e53cbe2
8c9d4b2
. This will also help decrease the compiled GWT output.

I've pushed a potential fix at
http://code.google.com/r/robertmunteanu-gwt-dispatch/source/detail?r=0a42aff67cd
c02344f02aa4a21365bce9b93e3de

Original comment by robert.munteanu on 2 May 2010 at 8:30

GoogleCodeExporter commented 9 years ago
I did try having ActionException and ServiceException both extend 
SerializationException, but it didn't remove 
the warning when running the GwtTest cases that have been added now, so I'm not 
sure it actually resolves the 
issue. Try running 'mvn integration-test' to see if the patch actually fixes it 
for you...

Original comment by Bitmei...@gmail.com on 2 May 2010 at 8:47

GoogleCodeExporter commented 9 years ago
The attached RPC log shows that the BatchResult.exceptions field pull in all 
known
subclasses of Throwable, as it is declared List<Throwable>:

com.google.gwt.user.client.rpc.SerializableException
   Serialization status
      Instantiable
   Path
      'com.google.gwt.user.client.rpc.SerializableException' is reachable as a
subtype of type 'class java.lang.Throwable'
      'java.lang.Throwable' is reachable from type argument 0 of type
'java.util.LinkedList<E>'
      'java.util.LinkedList<java.lang.Throwable>' is reachable as a subtype of type
'interface java.util.List<java.lang.Throwable>'
      'java.util.List<java.lang.Throwable>' is reachable from field 'exceptions' of
type 'net.customware.gwt.dispatch.shared.BatchResult'
      'net.customware.gwt.dispatch.shared.BatchResult' is reachable as a subtype of
type 'interface net.customware.gwt.dispatch.shared.Result'
      Started from 'net.customware.gwt.dispatch.shared.Result'

com.google.gwt.user.client.rpc.SerializableException[]
   Serialization status
      Instantiable
   Path
      'java.lang.Throwable' is reachable from type argument 0 of type
'java.util.Arrays.ArrayList<E>'
      'java.util.Arrays.ArrayList<java.lang.Throwable>' is reachable as a subtype of
type 'interface java.util.List<java.lang.Throwable>'
      'java.util.List<java.lang.Throwable>' is reachable from field 'exceptions' of
type 'net.customware.gwt.dispatch.shared.BatchResult'
      'net.customware.gwt.dispatch.shared.BatchResult' is reachable as a subtype of
type 'interface net.customware.gwt.dispatch.shared.Result'
      Started from 'net.customware.gwt.dispatch.shared.Result'

I'm not sure how we can fix this, besides forcing the resulting exceptions to 
be a
subclass of SerializableException.

Original comment by robert.munteanu on 2 May 2010 at 9:32

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm. The deprecation of SerializableException means that RPC services can no 
longer return anything as a 
generic Exception any more, essentially, right?

I think the solution is to create a 'DispatchException' superclass for 
ActionException and ServiceException, 
and add another subclass for 'UnexpectedException' or something like that which 
will contain some basic 
details from any RuntimeException or other exception classes, such as the 
'message' and the original 
exception class. Passing them as the 'cause' also has issues with 
serialization, so basically all exceptions have 
to be stripped down to be safe. Then, the BatchException will just contain a 
list of 'DispatchException' 
instances instead of the more generic 'Exception/Trowable'.

Can you think of any better ways?

Original comment by Bitmei...@gmail.com on 2 May 2010 at 10:36

GoogleCodeExporter commented 9 years ago
That's my reading of the deprecation of SerializableException. Also there's the 
problem of pulling in all available subclasses of Throwable, which we will 
avoid.

As for the DispatchException superclass, I think that's the best way of solving 
the 
current problem.

Original comment by robert.munteanu on 3 May 2010 at 6:10

GoogleCodeExporter commented 9 years ago
Ok, I've pushed up a change in rd8bc60146c which adds DispatchException as a 
common superclass for 
ActionException and ServiceException. This allows BatchResult to return a list 
of DispatchException, which 
reduces the potential exception tree and removes the warning.

A side-effect of this was making most 'execute' methods elsewhere (Dispatch, 
ActionHandler, etc) throw 
DispatchException. This shouldn't cause problems with existing ActionHandlers, 
since ActionException is a 
subclass of DispatchException and existing execute methods should still compile 
fine.

Original comment by Bitmei...@gmail.com on 3 May 2010 at 8:32