tags:

views:

972

answers:

4

Hi

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.

A: 

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
Chris Boesing
I don't compile GWT if I can avoid it , but uses the hot-swap of code with the Eclipse GWT plugin to Jetty. So I need to set the logging options elsewhere.
Claus Jørgensen
+2  A: 

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

Igor Klimer
GWT 2.0, with Java 1.5, so there's little meaning in using SerializationException precisely because of this. And it wouldn't make a lot of sense to use a deprecated class when this is precisely what the warning is about!
Claus Jørgensen
`SerializationException` is not deprecated (don't confuse it with `SerializableException`). And by using it explicitly you will tell the GWT compiler which classes it should expect - instead of pulling in everything related that extends `Exception`.
Igor Klimer
+1  A: 

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.

Bluu
A: 

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

Gunnar Wagenknecht