[antlr-interest] Java and static arrays: a serious joke
Rodrigo B. de Oliveira
rodrigobamboo at gmail.com
Fri Jun 2 21:14:59 PDT 2006
On 6/2/06, Terence Parr <parrt at cs.usfca.edu> wrote:
> I have to laugh...Java is really showing growing pains. I cannot
> allocate even small static arrays because it requires 6 bytes of code
> for each byte I want to put into a static array. Yes, Java makes a
> class init method that manually builds these arrays!
I can empathize with that :)
> ...
> So, what the HELL are we going to do in order to store transition
> tables for DFA in Java? Load the data from the disk? gawwwd!
> Seriously? How can you load static data into a Java class?
>
If I understood you correctly you should be able to split the
initialization through different methods:
static {
init_dfa_0();
init_dfa_1();
init_dfa_2();
....
}
static void init_dfa_0() { _dfa = new int[42*1024]; }
static void init_dfa_1() {
_dfa[0] = 0xF00;
...
}
....
It sucks but you know, whatever gets you through the night... :)
--
bamboo
*** See you at the first global db4o User Conference in London, July
10 and 11, 2006 ***
http://www.db4o.com/about/productinformation/events/duc2006/
More information about the antlr-interest
mailing list