Dan, you are ofcourse right about problem being BaseTypeCompiler holding
onto a reference to a declared method beyond one generated class. Once I
removed caching of that reference, I don't get the stack trace for my simple
test case anymore. Thank you.

As for why I added the pushDataValueFactory() to BaseTypeCompiler, let me
try to dig my memory. ExpressionClassBuilder is not passed to generateNull
and generateDataValue. In my local codeline, I had made changes so that
ExpressionClassBuilder gets passed to these 2 methods. (This had required
quite a few changes for different callers to now pass
ExpressionClassBuilder). But the main problem had something to do with
getBaseClassName() in ExpressionClassBuilder.pushDataValueFactory at line
639 not returning the correct value. I wish I could recall exactly why
I decided to create a new method rather than use what is in
ExpressionClassBuilder. I can try to backtrace my steps to find out the
exact reason if you would like.

Mamta


On 5/14/07, Daniel John Debrunner <[EMAIL PROTECTED] > 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?

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.


Reply via email to