Debugging problems with generated classes
When the code has been generated incorrectly, all sorts of odd things can go wrong. This is one recommended approach to finding the problem.
First, turn on ByteCodeGenInstr and DumpClassFile. Look for missing files (right now they are consecutively numbered by the activation class builder; later on they won't be, but BytCodeGenInstr dumps messages about the classes it has). Look at the log to make sure that all "GEN starting class/method" messages are paired with a "GEN ending class/method" message. If a file is missing or the pairing is missing, then something went wrong when the system tried to generate the bytecodes. Resort to your favorite debugging tool to step through the faulty statement.
If you get class files but the system crashes on you (I had an OS segmentation fault once) or you get funny messages like JDBC Excpetion: ac5 where ac5 is just the name of a generated class, then one of the following is likely:
org.apache.derby.iapi.services.compiler.JavaFactory
| Modifier and Type | Field and Description |
|---|---|
| private CacheManager |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | boot(boolean
True if the database should be created create, Properties Configuration properties properties)Implements org. Start this module. |
| public Cacheable | |
| public ClassBuilder | Returns: the class builder.ClassFactory to be used for class resolution (debug only)
and loading of the generated class. cf, String the name of the package the class is in.
null if it is in the default package. packageName, int the | of the Modifiers
constants representing the visibility and control of this
method. modifiers, String the name of the class or interface className, String the name of the superclass or superinterface superClass)Implements org. a class.</verbatim> |
| private static Object | startSystemModule(final String factoryInterface)
Must be private so that user code can't call this entry point. |
| public void | |
| pack-priv Type | |
| pack-priv String | |
| pack-priv static short |
| vmTypeIdCache | back to summary |
|---|---|
| private CacheManager vmTypeIdCache | |
| BCJava | back to summary |
|---|---|
| public BCJava() | |
| boot | back to summary |
|---|---|
| public void boot(boolean create, Properties properties) throws StandardException Implements org. Start this module. We need a read/write version of the class utilities
| |
| newCacheable | back to summary |
|---|---|
| public Cacheable newCacheable(CacheManager cm) Implements org. | |
| newClassBuilder | back to summary |
|---|---|
| public ClassBuilder newClassBuilder(ClassFactory cf, String packageName, int modifiers, String className, String superClass) Implements org. a class. Once it is created, fields, methods,
interfaces, static initialization code,
and constructors can be added to it.
| |
| startSystemModule | back to summary |
|---|---|
| private static Object startSystemModule(final String factoryInterface) throws StandardException Must be private so that user code can't call this entry point. | |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Stop this module. In this case, nothing needs to be done. | |
| type | back to summary |
|---|---|
| pack-priv Type type(String javaType) Get the VM Type ID that corresponds with the given java type name. This uses the cache of VM type ids. | |
| vmType | back to summary |
|---|---|
| pack-priv String vmType(BCMethodDescriptor md) | |
| vmTypeId | back to summary |
|---|---|
| pack-priv static short vmTypeId(String vmTypeS) Map vm types as strings to vm types as the VM handles, with int ids. Used in mapping opcodes based on type of operand/stack entry available. | |