correct

> -----Original Message-----
> From: Jason Voegele [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 29, 2007 2:13 PM
> To: [email protected]
> Cc: Tim Eck
> Subject: Re: [tc-dev] class merging quandary
> 
> On Thursday 29 November 2007 5:05:53 pm Tim Eck wrote:
> > One thing the merge process does not touch is constructors however,
> which
> > has lead to at least one bug. Consider this code:
> >
> > class HashMapTC {
> >    private boolean flag = true;
> > }
> >
> > Statements like that field set are duplicated into all constructors by
> the
> > regular java compiler. Since our merge process does not use
constructors
> > from the "TC" class, the merged class just ends up getting the field,
> but
> > not the assignment to true (instant bug!)
> >
> > I'm trying to figure out what the class merge should be doing here. I
> > guess it stands to reason that we need to behave just like the java
> > compiler does -- copy that statement into all constructors. That is
> > probably easier said than done since the compiler conceals the
structure
> > of the source when it duplicates things.
> 
> I don't have an immediate answer, but I think the same problem will also
> apply
> to initialization blocks, as these are also copied into each
constructor:
> 
> class HashMapTC {
>   private boolean flag;
>   {
>     flag = true;
>     // other initialization
>   }
> }
> 
> Any solution would need to consider initialization blocks in addition to
> field
> initializations.
> 
> --
> Jason Voegele
> "I once witnessed a long-winded, month-long flamewar over the use of
> mice vs. trackballs...It was very silly."
> (By Matt Welsh)

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to