Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT: Referencing deprecated class SerializableException

Tags:

java

gwt

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.

like image 764
Claus Jørgensen Avatar asked Jun 30 '26 19:06

Claus Jørgensen


2 Answers

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

like image 157
Igor Klimer Avatar answered Jul 02 '26 09:07

Igor Klimer


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.

like image 27
Bluu Avatar answered Jul 02 '26 07:07

Bluu