Daniel John Debrunner wrote:
Mamta Satoor wrote:
Hi,
I checked in code on April 24th revision 532082 for DERBY-2583 "At
code generation time, look at collation type to determine what kind of
DVD should get generated for character types."
The intention of the commit was to generate following
StringDataValueObject.getValue(DataValueFactory.getCharacterCollator(collationType));
This code generation change went in
BaseTypeCompiler.generateCollationSensitiveDataValue and it looked as
follows
protected void generateCollationSensitiveDataValue(MethodBuilder mb,
int collationType, String className){ if (collationType ==
StringDataValue.COLLATION_TYPE_UCS_BASIC)
return;
//In case of character DVDs, for territory based collation, we need to
//generate DVDs with territory based RuleBasedCollator and hence we
//need to generate CollatorSQLChar/CollatorSQLVarchar/
//CollatorSQLLongvarchar/CollatorSQLClob
pushDataValueFactory(mb, className);
Looking at stack trace, it looks like something is wrong in maybe my
code generation changes and wondered if someone familiar with code
generation can tell me what I am doing wrong. I will keep debugging
but any help will be greatly appreciated.
The issue may be to do with the method you added to BaseTypeCompiler
private void pushDataValueFactory(MethodBuilder mb, String className)
ExpressionClassBuilder already has a pushDataValueFactory(), was there a
need to create another one?
Is the idea here that we should add an argument and pass in an
ExpressionClassBuilder into
things generateNull and generateDataValue, and then use the
ExpressionClassBuilder.pushDataValueFactory.
The problem may be that ExpressionClassBuilder's lifetime is a single
class generation, thus it's fine for its pushDataValueFactory to hold a
reference to a declared method from MethodBuilder.describeMethod(). But
the lifetime of the BaseTypeCompiler objects may be longer, thus it may
be trying to use a reference to one method in one generated class in
another generated class.
Dan.