db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Re: DERBY-1478 subtask DERBY-2583 - need help in debugging stack trace thrown during code generation
Date Tue, 15 May 2007 07:25:49 GMT
I forgot to mention that another reason for including a pushDataValueFactory
in BaseTypeCompiler is ExpressionClassBuilder class is protected and hence
it is not visible outside of impl.sql.compile package and base of
CharTypeCompiler, CLOBTypeCompiler which is TypeCompiler is defined in
iapi.sql.compile package and hence it can't see ExpressionClassBuilder with
it's current protected definition. TypeCompiler needs access to
ExpressionClassBuilder  if we want to pass ExpressionClassBuilder as
parameter to generateDataValue and generateNull so that they can utilize
pushDataValueFactory defined on ExpressionClassBuilder. I remember changing
the definition of ExpressionClassBuilder to public. I can spend more time on
more/exact details to explain why I defined pushDataValueFactory in
BaseTypeCompiler.

Mamta


On 5/14/07, Mamta Satoor <msatoor@gmail.com> wrote:
>
> 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 <djd@apache.org > 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.
> >
> >
>

Mime
View raw message