I have to init a big constant data structure but I get the compiler error message:
The code of constructor MS_XXX(String) is exceeding the 65535 bytes limit
This is how the code may looks like:
public class MD_XXX {
public List<String> allElements;
public MD_XXX(String language) {
this.allElements = new ArrayList<String>();
if (...) {
/* 0 */ allElements.add("some text0");
/* 1 */ allElements.add("some text1");
/* 2 */ allElements.add("some text2");
.. many more lines here
BUT
I also have much more data structures to initialize, putting this into a DB is a real hassle – and again, this is confidential info.
What is the best way to solve this?
Do I really have to break this up into several class files or read it from a DB?
I really try to avoid the DB way, since this data should be secure to the app.
Many thanks
It is probably sufficient to split it into several methods. Add some private methods that you call from that super-long constructor and move parts of the code there. Each method can be 65535 bytes long.