Exclusion of methods from GWT modules

I have a class that I want to include in the GWT module. Unfortunately, it has a method that does not support GWT functions (it uses Class.isInstance in case you are interested). I do not use this method in my GWT application, but other applications other than GWT use this method, so I can’t just delete it. Is there a way to exclude this method in my module definition? Perhaps a method annotation can do this?

+4
source share
2 answers

There is no functionality in the GWT compiler to do this. This was discussed in detail on the GWT forums, but they decided not to use it for very good reasons.

Your only option (since you cannot change the object to delete this method) is to create a transfer object that you use instead of an object that does not compile under GWT.

+3
source

Another option is to use a super source. You can duplicate your class. Such a class will be an exact copy minus the methods you want to exclude. Then add the superuser directive to include this duplicate class.

The disadvantage of this is that you violate the principle, do not repeat yourself (DRY). It is also important to understand that in the placement mode the actual class will be called, not the super-source.

0
source

All Articles