On Thu, Dec 3, 2009 at 11:00 AM, Jonathan Ellis <jbel...@gmail.com> wrote:
> i think historically there has been a no-arg constructor and one w/ all > args. > > imo correct behavior is one with only req'd args, and one w/ all. > > I think having one with no args is good as well. The problem with having one with only required args is that java doesn't have keyword arguments. So, if you have a struct with several required members, you're going to have "new Foo(a,b,c,d,e,f)" for example. If the order (or names) of fields changes or something, you can break your app without generating a compilation error, whereas if you're using explicit setters, you'll catch it. -Todd rule of thumb: if it breaks cassandra, it's a bug. :) > > On Thu, Dec 3, 2009 at 12:36 PM, Gary Dusbabek <gdusba...@gmail.com> > wrote: > > 2009/12/3 Ted Zlatanov <t...@lifelogs.com>: > >> On Thu, 3 Dec 2009 06:42:27 -0600 Gary Dusbabek <gdusba...@gmail.com> > wrote: > >> > >> GD> This seems to be a Thrift regression. It is failing to generate any > >> GD> but the no-arg constructors. I saw this about a week ago but never > >> GD> got around to filing a Thrift ticket against it. > >> > >> GD> Your best bet, other than rolling back to an older version of > thrift, > >> GD> is to add the constructors yourself from the old code. > >> > >> I could also file a Thrift bug. Or are you implying you'll do it? > > > > If it is a bug. I never made time to do the research, but here is > > what seems to be happening... > > > > Optional members are not included in the constructor, required members > > are. I'm not sure if they ever were, and the constructors were just > > manually added after generation or not. > > > > E.g., > > > > struct ColumnParent1 { > > 3: required string column_family, > > 4: optional binary super_column, > > } > > > > generates: > > > > public ColumnParent1(String column_family) > > { > > this(); > > this.column_family = column_family; > > } > > > > whereas: > > > > struct ColumnParent3 { > > 3: required string column_family, > > 4: required binary super_column, > > } > > > > generates: > > > > public ColumnParent3(String column_family, byte[] super_column) > > { > > this(); > > this.column_family = column_family; > > this.super_column = super_column; > > } > > > > > > Changing the optional fields to required solves the problem and > > creates the necessary constructors, or the required constructors can > > be added. > > > > Unfortunately, I'm a thrift noob too. Old-timers, what is the correct > behavior? > > > > Gary. > > >