3
votes

When using GWT I get following warning:

Referencing deprecated class 'com.google.gwt.user.client.rpc.SerializableException'

While it's only a warning, it's dead annoying having to look at every single time I run the project.

The warning occours since my RPC throws java.lang.Exception, and thus never actually uses the SerializableException, but GWT isn't clever enough to figure that out.

Is there a option to turn off the warning, or fix this, besides compiling my own version of the gwt-user/gwt-servlet libraries?

Thanks.

Edit: To clarify, this is GWT 2.0, and the project is being run from the Google Plugin in Eclipse.

4

4 Answers

2
votes

Someone on the GWT's Google Group suggested using SerializationException instead of just Exception. Although, the javadocs for SerializableException suggest that Exception should be fine too :/ Which version of GWT are you using?

Deprecated. As of GWT 1.5, Exception implements Serializable and can be used in place of this [SerializableException] class

1
votes

Lombardi's blog has a discussion of why exactly this is happening in the source.

Yeah, it's silly for Google to claim throwing Exception is a fine thing to do when it generates a lot of unnecessary JavaScript for subclasses of Exception and, in your case, generates warnings about those subclasses.

But this is all the more reason to throw a more specific exception (one that doesn't have a deprecated descendant). Unchecked exceptions on your RPC can still be handled by an UncaughtExceptionHandler.

0
votes

You could set the loglevel of the gwt compiler. It seems like you have set yours to "warn", set it to info to get rid of the message. If you are using eclipse do the following steps:

  1. right click on the project
  2. Google >> GWT Complie
  3. Set the Log Level to info
0
votes

Although extending SerializationException is a workaround, the contract of SerializationException indicates that it should not be used as a parent class of your custom RPC exceptions. It's there to indicate issues with the serialization itself and not with the logic within your services.

The underlying issue is that the compiler generates unnecessary code. To avoid the error simply make sure that your code does not use SerializableException anymore and add the following line to your module descriptor.

<extend-configuration-property name="rpc.blacklist" value="com.google.gwt.user.client.rpc.SerializableException"/>

Once the compile issue is fixed, you can remove the line again. Here is a link to the issue you might wanna star/follow: http://code.google.com/p/google-web-toolkit/issues/detail?id=4438