Compilation Problem (method load() exceeding the 65535 bytes limit)

Hi,
I have two custom components(with client side code) in my project. If I’m compiling each of them alone it works. If I’m compiling both together I get this error:


Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR]
 Errors in 'generated://8A2D22F6BEDD632A1630E25BB6905289/com/vaadin/client/metadata/ConnectorBundleLoaderImpl.java'
      [ERROR]
 Line 2396: The code of method load() is exceeding the 65535 bytes limit
      See snapshot: C:\Users\Stefan\AppData\Local\Temp\com.vaadin.client.metadata.ConnectorBundleLoaderImpl7325425627961124376.java
   [ERROR]
 Errors in 'com/vaadin/client/metadata/ConnectorBundleLoader.java'
      [ERROR]
 Line 35: Rebind result 'com.vaadin.client.metadata.ConnectorBundleLoaderImpl' could not be found

Is there really a Problem with to many client classes? There are about 60 classes. The load()-function has 10.000 lines of code.
Thanks.

P.S: The problem seems to be that Java methods couldn’t contain more than 65535 bytes. Is there any workaround, or am I limited through this?

Interesting issue. Seems that we could quite easily fix this by splitting the generated load method into smaller parts as needed. I created
ticket #10221
for tracking this issue.

You should be able to continue working with your app by making the widgetset compiler split the connector metadata into multiple load methods by adding e.g. loadStyle = LAZY to the @Connect annotation of some of your connectors.

Thank you for reporting this issue!

Ok, I’ll try this.
Thank you.

I’m getting a slightly different error:
[ant:java]
Compiling module com.secondfloor.core.ui.GXTWidgetSet
[ant:java]
[ERROR]
Errors in ‘generated://5F9E2E610752598C3756AB118055DB64/com/vaadin/client/metadata/ConnectorBundleLoaderImpl.java’
[ant:java]
[ERROR]
Line 269: Syntax error on token “extends”, . expected
[ant:java]
[ERROR]
Line 426: Syntax error on token “extends”, . expected
[ant:java]
[ERROR]
Line 2313: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 2315: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Line 9530: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 9532: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Line 9559: T cannot be resolved to a type
[ant:java]
[ERROR]
Line 9559: Syntax error on token “extends”, . expected
[ant:java]
[ERROR]
Line 9560: Syntax error on token “?”, invalid Name
[ant:java]
[ERROR]
Line 9998: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 10000: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Line 10223: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 10225: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Line 10244: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 10246: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Line 10260: The constructor AsyncBundleLoader() is undefined
[ant:java]
[ERROR]
Line 10262: The constructor TypeDataBundle() is undefined
[ant:java]
[ERROR]
Errors in ‘com/vaadin/client/metadata/ConnectorBundleLoader.java’
[ant:java]
[ERROR]
Line 35: Rebind result ‘com.vaadin.client.metadata.ConnectorBundleLoaderImpl’ could not be found

I’m not sure if these errors are related ?!?

The suggested workaround (lazy connect annotation) does not work.

If you run in DEV mode you can make it output the generated code using the -gen parameter. Then you can see what is wrong with the generated code and maybe somebody can fix it

Those errors seems to be related to some obscure syntax error in code generated by the compiler.

I would like to have a look at the problem, but I don’t have any way of reproducing it and the errors doesn’t tell me anything particular without also seeing the actual generated code. Could you post relevant parts of the generated file (the compiler should save the invalid file in a temp folder and output its location at some point) or send the file to leif@vaadin.com if it contains application details that you don’t want to make publicly available?

The fix for
Ticket #10221
will be included in the next snapshot that should be available in about 10 hours. Please test it to verify that the problem has indeed fixed.

Thanks for that hint.

Turns out it fails on a custom GXTGridRpc class which uses generics. The GXTGridRpc.java is like this:

public interface GXTGridRpc<T> extends ServerRpc {
    public void selected(T bean);
}

Which results in the following generated code:
store.setProxyHandler(com.secondfloor.core.ui.shared.GXTGridRpc.class, new com.vaadin.client.metadata.ProxyHandler() { public Object createProxy(final com.vaadin.client.metadata.InvokationHandler handler) { return new com.secondfloor.core.ui.shared.GXTGridRpc() { public void selected(T extends java.lang.Object p0) { handler.invoke(this, com.vaadin.client.metadata.TypeData.getType(com.secondfloor.core.ui.shared.GXTGridRpc.class).getMethod("selected"), new Object [] {p0, }); } }; } });

I guess it was my ignorance in using generics, I presume it’s not legal to use typed classes when extending ServerRpc ?!?

Barry

It seems generics in Rpc interfaces is not supported, and I suspect there’s nothing else we could do about that than to abort the widgetset compilation with a more helpful message.

I created
ticket #10392
for tracking this issue.

Thanks!