I have a cross platform (B4A/B4i) app which compiles fine on B4A, but the B4i compiler stops with the following message:
Rich (BB code):
B4i line: 1179
End Sub
shell\src\com\powercruisecontrol\check\b4i_carmodel_subs_0.java:165: error: code too large for try statement
catch (Exception e) {
^
1 error
The referenced line is the "End Sub" of a Sub with no try/catch statements at all.
Looking at the java code, it looks like a try/catch is automatically inserted by the compiler.
Is there a workaround for this?
Without seeing the code I'm guessing in the dark but can't you split the code. Use CreateMap for the elements that aren't going to fail and add the ones that might in a try block afterwards?
This error can happen with very large subs, in debug mode. It hits a limit of the Java compiler. As @DonManfred wrote, the solution is to split the large sub.
It sometimes happen when the developer puts the data inside the code. Something that isn't recommended.
This error can happen with very large subs, in debug mode. It hits a limit of the Java compiler. As @DonManfred wrote, the solution is to split the large sub.
It sometimes happen when the developer puts the data inside the code. Something that isn't recommended.
this case is peculiar: the sub is not "large" (550 lines), but consisting of a CreateMap of objects.
i don't see how this kind of data can be put outside of the code.
B4X:
dataset = CreateMap( _
CAR1: Array As Object(m_1, m_2), _
CAR1: Array As Object(m_1, m_3, m_4), _
...
There is a 64k limit on modules, of either code or literal data or both (can't remember).
550 lines would average to 120 bytes per array of objects, and between the array descriptor and the objects and maybe associated garbage-keeping information, it wouldn't surprise me if an array of three objects was around that same size.
I know the Select Case statement is large. When i run the class it leads to this error. But when i compile, it is ok. Should I be concerned with this? Will it pose a problem if i don't split it? It did compile ok. B4A Version: 9.01.2 Java Version: 8 Parsing code. (0.45s) Building...
www.b4x.com
and it took me a while to find the more-detailed info on it because that page no longer exists: