Too many parameters in a generated Java file for uibinder - One defect in uibinder generator

444 views
Skip to first unread message

James

unread,
Aug 10, 2012, 8:57:13 AM8/10/12
to google-we...@googlegroups.com

I have a big uibinder file to collect user inputs. This uibinder file has a lot of ui:fields. When I compiled it. I got the following error. There are many Templates are generated and one of them cause this error. My code is 100% right. There is one defect in UiBinder generator.

[ERROR] Errors in 'generated://AD04AD9F809E702F4D4A194C91C033A7/com/google/data/client/ui/DataTypesTestDetailViewImpl_DataTypesTestDetailViewBinderImpl.java'
[ERROR] Line 26: Too many parameters, parameter arg254 is exceeding the limit of 255 words eligible for method parameters
See snapshot: C:\Users\james\AppData\Local\Temp\com.
google.data.client.ui.DataTypesTestDetailViewImpl_DataTypesTestDetailViewBinderImpl7128410725109238784.java
[ERROR] Unable to find type 'com.
google.data.client.ui.DataTypesTestDetailViewImpl_DataTypesTestDetailViewBinderImpl.Template'
[ERROR] Hint: Check that the type name 'com.
google.data.client.ui.DataTypesTestDetailViewImpl_DataTypesTestDetailViewBinderImpl.Template' is really what you meant
[ERROR] Hint: Check that your classpath includes all required source roots



Thanks,


James

Jens

unread,
Aug 10, 2012, 9:22:56 AM8/10/12
to google-we...@googlegroups.com
I think you simply can't have more than 255 method arguments in Java and the generator does not check this. Honestly I think it does not really make sense to have that many ui:fields in a single file. The input data is probably categorizable so I would create one UiBinder per data category. 

Splitting your UiBinder file in smaller parts to reduce the amount of ui:fields per UiBinder is the only simple solution for you now. Otherwise you have to patch the generator to respect the 255 argument limit and contribute the patch.

-- J.

Thomas Broyer

unread,
Aug 10, 2012, 10:17:43 AM8/10/12
to google-we...@googlegroups.com
No need to split the template, just throw a few <g:HTMLPanel> here and there to split the generated SafeHtmlTemplate method.

Joseph Lust

unread,
Aug 10, 2012, 4:27:07 PM8/10/12
to google-we...@googlegroups.com
Or, as I've done for large grids of buttons, you can just not UiBind & the @UiField annotation.

Instead use a @UiFactory to instantiate them and store their references at creation time. Then you can access them with those references when needed. This way you don't need to break up your UI into smaller pieces or binders.


Sincerely,
Joseph
Reply all
Reply to author
Forward
0 new messages