I have an web screen with several webblocks inside it. When we include a piece of new "code", we receive this error in ServiceCenter Error Log: "Too many constants, the constant pool for "MyPage.jsf" exceed 65536 entries"

The error occurs in a page that contains a few webblocks, and inside each one we have a lot of stuff (other webblocks, screen actions, page elements, etc.). Each one of these webblocks is inside an 'If' control that is triggered by a parameter in the URL.

After I have added a new webblock to this page, when I try to publish from Service Studio, the Error Log gets this error.

After some googling, I see that It's related with the limit of objects (constantes, methods, variables, etc.) inside a jsp page. The only logical conclusion is that the final jsp generated by the platform has reached this limit.

For now I'm refactoring this huge WebScreen, creating smaller pages and changing the method of calling these pages.

João,
The limit you reached is related with the constants per class, limited by the 16-bit constant pool.
The exact limitation as per official documentation is:

The per-class or per-interface constant pool is limited to 65535 entries by the 16-bit constant_pool_count field of the ClassFile structure (§4.1). This acts as an internal limit on the total complexity of a single class or interface.

I'm interested to know what constitutes a 'constant' in the OutSystems->Java code compilation. Does each "thing" (e.g. web screen, perparation, web clock, container, button, link) create 1 constant? If I had a web block with 4 buttons, does that mean I have 5 total constants?

And how are the classes broken up? Can you have a maximum of 65535 constants period in OutSystems, or is it something more like 65535 constants per web block?

Taking aside OutSystems Platform and how is the class build up, from Java side the constant pool works this way:

constant_pool[]

The constant_pool is a table of structures representing various string constants, class and interface names, field names, and other constants that are referred to within the ClassFile structure and its substructures. The format of each constant_pool table entry is indicated by its first "tag" byte.

The constant_pool table is indexed from 1 to constant_pool_count - 1.

constant_pool_count

The value of the constant_pool_count item is equal to the number of entries in the constant_pool table plus one. A constant_pool index is considered valid if it is greater than zero and less than constant_pool_count, with the exception for constants of type long and double.