Closed abhilashgoyal closed 1 year ago
This is simply not possible. There are too many things which contribute to the constant pool to be able to count them with any accuracy. Moreover, many of them will be inside of CodeBlock contents which we cannot parse.
When big files fail they can fail in many ways: too large of a method, too large constant pool, too many methods, too many arguments to a method, etc. The best you can do is partition your output at reasonable breakpoints as is possible with whatever you're generating.
In my usecase, when I am generating Java file, it is complaining about
too many constants
error [https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error]. IMO, we should have this counter in JavaFile object, so we know before hand if this will generate a valid .java file or is there need to split the generated code.