Class limits for Javelin.
Derry
Posts: 8
Peter, you mentioned recently a limit of 64 methods in a class. Does this number include all methods of superclasses or just the individual class being defined? Do you (or anyone else) know what other limits there might be?
I've built a solar thermal controller with a MODBUS/ASCII interface. I wrote a simple language for defining the MODBUS variables, and a generator to create a Java class containing the various constants, variables and methods needed to work with those variables. The problem is that it is BIG. This controller has about 85 parameters, sensor inputs and relay outputs that are represented in MODBUS variables. That means the generated class contains 85 (plus a few) scalar variables, 85 instances of a class that describes the MODBUS variables, 85 (plus a few) "set" methods, a method containing a switch statement with 85 cases, a few hundred static final constants... You get the idea. I think there are steps I can take to reduce these numbers or split up the file, but I would like to do it by some means other than trial and error. Thanks.
I've built a solar thermal controller with a MODBUS/ASCII interface. I wrote a simple language for defining the MODBUS variables, and a generator to create a Java class containing the various constants, variables and methods needed to work with those variables. The problem is that it is BIG. This controller has about 85 parameters, sensor inputs and relay outputs that are represented in MODBUS variables. That means the generated class contains 85 (plus a few) scalar variables, 85 instances of a class that describes the MODBUS variables, 85 (plus a few) "set" methods, a method containing a switch statement with 85 cases, a few hundred static final constants... You get the idea. I think there are steps I can take to reduce these numbers or split up the file, but I would like to do it by some means other than trial and error. Thanks.
Comments
methods < 64
strings < 128
statics < 128 (not static final I believe)
Wether those limits are fixed I don't know. They could depend on total code size.
When you extend a class the superclass and extended class methods are summed.
I guess that also applies to strings and statics.
Usually it compiles ok even if you cross the limits, but when you try to program
an error message appears.
I would say if your program compiles and programs ok just keep it until such message
appears. On the other hand, 85 methods for a class is alot. I am sure you define
several logic blocks in your class that could be placed in a seperate class.·That usually
also clarifies your program.
regards peter
Derry
are nearly identical, perhaps you could simplify that to
public int setX(int xx, boolean value)
public int setY(int yy, int value)
and define your xx and yy as constants.
regards peter